Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Compare data between current value and previous value – Kusto

I want to find the id value of rows whose humidity

is greater than the previous day humidity.


datatable(id:int, recorddate:datetime, humidity:real)

[

    1, datetime(2022-11-01), 10.0,

    2, datetime(2022-11-02), 12.0,

    3, datetime(2022-11-03), 15.0,

    4, datetime(2022-11-04), 18.0,

    5, datetime(2022-11-05), 20.0,

    6, datetime(2022-11-06), 22.0,

    7, datetime(2022-11-07), 19.0,

    8, datetime(2022-11-08), 16.0,

    9, datetime(2022-11-09), 14.0,

    10, datetime(2022-11-10), 11.0,

];

desired response:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

id

2

3

4

5

6

Above ids have values greater than their previous row value.

>Solution :

You could use the prev() function.

For example:

T
| order by record_date asc
| where prev(humidity) < humidity
| project id
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading