Forum Discussion
Calculating Next Row
- 5 years ago
Hi BenBrubacher ,
Based on your description, I think creating an index column based on page number in the query editor will make things easier.
Then use this index column and the ALL function to get the result.
PET = VAR _INDEX = SELECTEDVALUE('Table'[Index]) VAR _PET = CALCULATE(MAX('Table'[PST]),FILTER(ALL('Table'),'Table'[Index]=_INDEX+1)) RETURN IF(ISBLANK(_PET),MAX('Table'[CET]),_PET)D = VAR _PET = [PET] VAR _PST = MAX('Table'[PST]) RETURN (_PET-_PST)*86400Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Images didnt post properly, heres the current dataset
Here's what I want it to look like?
Hi BenBrubacher ,
Based on your description, I think creating an index column based on page number in the query editor will make things easier.
Then use this index column and the ALL function to get the result.
PET = VAR _INDEX = SELECTEDVALUE('Table'[Index])
VAR _PET = CALCULATE(MAX('Table'[PST]),FILTER(ALL('Table'),'Table'[Index]=_INDEX+1))
RETURN IF(ISBLANK(_PET),MAX('Table'[CET]),_PET)D = VAR _PET = [PET]
VAR _PST = MAX('Table'[PST])
RETURN (_PET-_PST)*86400
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.