
Comprehensive Detailed Explanation
Step 1: Understanding the requirement
We need a KQL query that:
Reads data from Weatherdata.
Orders by Datetime.
Calculates Delta_temperature as the difference between the current row and the preceding row.
Returns the final columns: Datetime, Lat, Long, Temperature, Delta_temperature.
Step 2: Evaluate the provided statements
Weatherdata → Starts the query with the source table.
| sort by Datetime asc → Ensures chronological order, required for prev() to work correctly.
| extend Delta_temperature = Temperature - prev(Temperature) → Computes difference between the current row and the previous row’s temperature.
| project Datetime, Lat, Long, Temperature, Delta_temperature → Selects the required output columns.
Step 3: Incorrect choices (to avoid)
next(Temperature,1) → Would calculate the difference with the next row, not the previous.
prev(Temperature,2) → Would skip one row, giving the difference with two rows back, which is not needed.
summarize … by Datetime → Aggregates the data; not required here since we just need row-level differences.
Step 4: Final Correct Sequence
Weatherdata
| sort by Datetime asc
| extend Delta_temperature = Temperature - prev(Temperature)
| project Datetime, Lat, Long, Temperature, Delta_temperature
References
prev() function in KQL
extend operator in KQL
project operator in KQL