Forum Discussion
Anonymous
3 years agoNot applicable
DAX Calculation based on Previous Row
I have a dataset of columns (Index & Step 1) I am trying to achieve the below calculations for Step 2 and Final Any suggestions? Thanks
- 3 years ago
Anonymous
It has to be of integer data or date (unique date) type.
tamerj1
3 years agoCommunity Champion
Hi Anonymous
Please refer to attached sample file with the solution
Step 2 =
VAR CurrentIndex = 'Table'[Index]
VAR TableBefore = FILTER ( 'Table', 'Table'[Index] < CurrentIndex )
VAR P1 = COUNTROWS ( TableBefore ) + 1
RETURN
SUMX (
TableBefore,
VAR X = 'Table'[Step 1]
VAR P = P1 - 'Table'[Index]
RETURN
( 0.5 ) ^ P * x
)Step 3 = 'Table'[Step 1] + 'Table'[Step 2]