marusla
November 24, 2025, 9:17pm
1
Hello i have this code
| fieldsAdd FechaTs = toTimestamp(Fecha)
| summarize
FechaInicial = min(FechaTs),
FechaFinal = max(FechaTs),
by: { Identificador }
| fieldsAdd
DiffMs = toLong(FechaFinal - FechaInicial),
DiffSec = toLong((FechaFinal - FechaInicial) / 1000)
| sort DiffMs desc
Hi @marusla 🙂
You can calculate the difference directly during the pipeline by adding a new field that performs the subtraction between the two values you already computed.
For example, after defining DiffMs and DiffSec, simply add:
| fieldsAdd Difference = DiffMs - DiffSec
So your full query would look like:
| fieldsAdd FechaTs = toTimestamp(Fecha) | summarize FechaInicial = min(FechaTs), FechaFinal = max(FechaTs), by: { Identificador } | fieldsAdd DiffMs = toLong(FechaFinal - FechaInicial), DiffSec = toLong((FechaFinal - FechaInicial) / 1000) | fieldsAdd Difference = DiffMs - DiffSec | sort DiffMs desc
This adds a new column with the subtraction result without modifying the rest of your logic.
Best regards,
marusla
November 24, 2025, 9:45pm
3
i use the commands, but stil have the problem
marusla
November 25, 2025, 1:42am
4
Thanks, i have i have to use other convertion
| summarize FechaInicial = min(Fecha), FechaFinal = max(Fecha), by: { Identificador}
| fieldsAdd Duracion = (totimestamp(FechaFinal) - totimestamp(FechaInicial))