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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
Anonymous
Not applicable

Calculation Based on Previous Row

Hi, 

I have a DAX formula that solves a an equation where I have two different columns and I am finding the difference between the previous row of one column and the current row of a different column

(EX: CUSTUM (Current Row) - IMPROVEMENT 1 (Previous Row)).

However, I am getting very stuck because when there would be a 0 value for improvement it would be replaced with the original value of Current Row. I am getting very stuck on how to create a DAX formula that If Improvement 1 value = 0 then the custum row will be the same value as the previous row. 

 

 

HELP_PLS_0-1666602869161.png

 

CURRENT TABLES 

 

Current Improvement          Custom 

           10                                  100

           12                                  90

            0                                   78

            5                                   100

            0                                   95

            10                                 100

 

 

 

*****I am hoping to make 

 

 

Current Improvement          Custom 

           10                                  100

           12                                   90

            0                                    78

            5                                    78

            0                                    73

            10                                  73

 

 

Thank you very much for the help!! 🙂 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

Try this formula:

Column = 
var start_custom = CALCULATE(SUM('Table'[Custom]),FILTER('Table','Table'[Index]=1))
var cumulative_CI = CALCULATE(SUM('Table'[Current Improvement]),FILTER('Table','Table'[Index]<=EARLIER('Table'[Index])-1))
return
start_custom-cumulative_CI

vjaywmsft_0-1666753201232.png

 

Best Regards,

Jay

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

 

Try this formula:

Column = 
var start_custom = CALCULATE(SUM('Table'[Custom]),FILTER('Table','Table'[Index]=1))
var cumulative_CI = CALCULATE(SUM('Table'[Current Improvement]),FILTER('Table','Table'[Index]<=EARLIER('Table'[Index])-1))
return
start_custom-cumulative_CI

vjaywmsft_0-1666753201232.png

 

Best Regards,

Jay

Anonymous
Not applicable

Thank You!!

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

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

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors