Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Using DAX to calculate difference on previous row

Hi All,   I have the following table and would like to translate progress on a project, to the actual percentage contributed per month. So essentially I would like to do a difference between row 3 ...
  • vikrantarora25's avatar
    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