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

DAX Syntax to calculate the delta of values between rows by another column

New to DAX. I have a single values column (Units)  and another column with Scenario. . I am trying to create a DAX calc that subtracts Scenario 1 from Scenario 2 on each line item. 

 

Here's my data table below as well as a screenshot of the pivot table view I'm trying to recreate (Pivot Table View), specifically the Deltas section, but would like to leverage DAX. Currently, I'm using power query to create calculated columns for the Deltas to create a new scenario called Deltas, then stitching it as a third scenario. This is resource intensive when done over many columns/rows.

 

CustomerProductScenarioQuarterUnitsPrice
Customer AProduct AScenario 1CQ1-2355$49.00
Customer BProduct AScenario 1CQ1-2381$77.00
Customer CProduct BScenario 1CQ1-2323$98.00
Customer AProduct AScenario 1CQ2-2398$62.00
Customer BProduct AScenario 1CQ2-2367$61.00
Customer CProduct BScenario 1CQ2-2378$8.00
Customer AProduct AScenario 2CQ1-2338$45.00
Customer BProduct AScenario 2CQ1-2373$79.00
Customer CProduct BScenario 2CQ1-2327$22.00
Customer AProduct AScenario 2CQ2-2379$90.00
Customer BProduct AScenario 2CQ2-2339$74.00
Customer CProduct BScenario 2CQ2-235$79.00
3 REPLIES 3
lbendlin
Super User
Super User

I am trying to create a DAX calc that subtracts Scenario 1 from Scenario 2 on each line item. 

Please define what you mean by "line item". Power BI aggregates everything automatically, and the only way to prevent that is to have unique values in each line - which you don't have.

 

Other than that you can use filters to calculate the required measure

 

lbendlin_0-1682806362048.png

 

Anonymous
Not applicable

Appreciate the response! I'm actually working within Excel's data model and trying to recreate the view with DAX in the linked image below which shows the unit delta between scenarios. (and additionally could add Revenue, Price deltas etc as well). Pivot Table View 

 

The view you show in Power BI is close, except difficult to read with the Deltas being shown as a column and duplicated, vs being shown as third row beneath Scenario 2. 

Your desired outcome is a little contrary to Power BI's philosophy.  You might be better off if you continue to use Excel for that.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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