PI SQL function for value change

Discussion created by JonasPolfliet on Nov 22, 2020



I'm new on the PI SQL statements and I’m getting to know it.

For a Power BI sql data query I want to get all the values and timestamps of 1 year for a certain datapoint.


Then I want to calculate how long a the data point had a certain value. 

I would be nice to get the value and timestamp on change of the datapoint.



Timestamp                           Value 

15/11/2020 15:20:00            5

15/11/2020 18:30:00            4

17/11/2020 01:00:00            1



Otherwise I need to query all the data with Intervalstep/Timestep which needs to be short to get accurate data.