Practice Exam

Question 60 of 75

Complete The KQL Query To Compare Values

You work as a Data Analyst for Mark at MDFT Pro, a well-known training agency. MDFT Pro operates a KQL database that tracks utility meter readings across various training facilities. The database contains a table named Readings that stores meter reading data including city, area, meter reading values, and timestamps. Mark has asked you to create a KQL query that compares each meter reading value to the previous reading based on the timestamp, allowing the agency to monitor consumption patterns across their facilities. The expected output should show each reading alongside the previous reading and its timestamp for easy comparison.

CityAreaMeterReadingTimestampPrevMeterReadingPrevTimestamp
KansasArea115002024-07-30 10:00:00
KansasArea215202024-07-30 11:00:0015002024-07-30 10:00:00

How should you complete the KQL query below to reproduce this output?

Readings
| filter City == "Kansas"
| sort by Timestamp
| _____________ PrevMeterReading = prev(MeterReading)
    PrevTimestamp = prev(Timestamp)
| project City, Area, MeterReading, Timestamp, PrevMeterReading, PrevTimestamp

Choose the correct answer from the options below.

Explanations for each answer:

Learn more about the KQL extend operator:
KQL Extend Operator
Next Question
Discuss this question on social media: