Forum Discussion
Using DAX to calculate difference on previous row
- 6 years ago
First add an Index column to your table using query editor, then add the calculated column for % contribution & use Lookupvalue function with IF.
Table1[% Contribution] =
IF (
Table1[Index] = 1,
LOOKUPVALUE ( Table1[Project A], Table1[Index], Table1[Index] ),
LOOKUPVALUE ( Table1[Project A], Table1[Index], Table1[Index] )
- LOOKUPVALUE ( Table1[Project A], Table1[Index], Table1[Index] - 1 )
)If this solves your query please mark this as a accepted solution.
Regards
First add an Index column to your table using query editor, then add the calculated column for % contribution & use Lookupvalue function with IF.
Table1[% Contribution] =
IF (
Table1[Index] = 1,
LOOKUPVALUE ( Table1[Project A], Table1[Index], Table1[Index] ),
LOOKUPVALUE ( Table1[Project A], Table1[Index], Table1[Index] )
- LOOKUPVALUE ( Table1[Project A], Table1[Index], Table1[Index] - 1 )
)
If this solves your query please mark this as a accepted solution.
Regards
Thank you, worked perfectly and gave the exact output I required.
Thanks!