Forum Discussion
undefined
I couldnt get the frist option to work because it said that Select was not a function. The screenshot above was be doing the second option and it was just producing the same TSCST value rather than the previous date/value.
Ideally what i would like to create is a new column that shows the previous data row recorded. For example with column BHCC_WQI59914B_OUT would be:
BHCC_WQI55914B_OUT tsCST
2859.609375 1/12/2024 10:00:00 AM
2848.701660156 1/12/2024 9:00:00 AM
2837.9265 1/12/2024 8:00:00 AM
2828.04833 1/12/2024 7:00:00 AM
........ ..........
- AlexisOlson2 years agoSuper User
My bad. I wrote SELECT instead of SELECTCOLUMNS in the first and "<=" instead of "<" in the second. I've corrected this above.
As to your second point, OFFSET returns a row, so you can select a different column rather than the timestamp column:
Prev_tsCST = SELECTCOLUMNS ( OFFSET ( -1, TableName, ORDERBY ( TableName[tsCST], ASC ) ), "Prev_BHCC_WQ159914B_OUT", TableName[BHCC_WQ159914B_OUT] )