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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
zervino
Helper I
Helper I

Delta between values of same column but different rows

I have a table like this:

 

PlanMonthCustomerSales
Budget5ABC100
Actuals5ABC50
Forecast5ABC130

 

I want to create a measure that compares always against the "Actuals" of the same month and customer:

 

PlanMonthCustomerSalesvs Actuals
Budget5ABC10050
Actuals5ABC500
Forecast5ABC13080

 

How can I achieve this?

 

Thanks

3 REPLIES 3
v-hjannapu
Community Support
Community Support

Hi @zervino,

Thank you  for reaching out to the Microsoft fabric community forum.
Thank you @lbendlin, for you reply regarding the issue.

By creating this Dax measure you may achieve :

vs Actuals = 
VAR currentMonth = SELECTEDVALUE('SalesData'[Month])
VAR currentCustomer = SELECTEDVALUE('SalesData'[Customer])
VAR actualSales = 
    CALCULATE(
        SUM('SalesData'[Sales]),
        'SalesData'[Plan] = "Actuals",
        'SalesData'[Month] = currentMonth,
        'SalesData'[Customer] = currentCustomer
    )
RETURN
IF(SELECTEDVALUE('SalesData'[Plan]) = "Actuals", 0, SUM('SalesData'[Sales]) - actualSales)

I tested it with  sample data, and it working fine. Please find the attached screenshot and Pbix for your reference.

vhjannapu_0-1750654183080.png

If the response has addressed your query, please Accept it as a solution and give a 'Kudos' so other members can easily find it

Best Regards,
Harshitha.

Greg_Deckler
Super User
Super User

@zervino Try:

vs Actuals Measure = 
  VAR __Sales = MAX( 'Table'[Sales] )
  VAR __Actuals = MAXX( FILTER( ALL( 'Table', [Plan] = "Actuals" ), [Sales] )
  VAR __Result = __Sales - __Actuals
RETURN
  __Result


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Ooh, look, a Calculate 🙂

 

lbendlin_0-1750514941284.png

vs Actuals = sum('Table'[Sales])-CALCULATE(sum('Table'[Sales]),'Table'[Plan]="Actuals")

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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