Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

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 and row 2 of the "Project A" column. I have been trying other solutions online using DAX but without success. The table below illustrates "Project A - Progress per month" which I wish to calculate with DAX.

 

Table1

Month:      Project A       Project A - Progress per month

Jul-20        0%                 (blank) 

Aug-20      8%                 8%

Sep-20       18%              10%

Oct-20       27%               9%

Nov-20      35%               8%

Dec-20      47%               12%

 

1 ACCEPTED SOLUTION

First add an Index column to your table using query editor, then add the calculated column for % contribution & use Lookupvalue function with IF. 

vikrantarora25_0-1597308007818.png

 

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

View solution in original post

2 REPLIES 2

First add an Index column to your table using query editor, then add the calculated column for % contribution & use Lookupvalue function with IF. 

vikrantarora25_0-1597308007818.png

 

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

Anonymous
Not applicable

Thank you, worked perfectly and gave the exact output I required.

 

Thanks!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.