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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Calculate difference 2 sales where we have sales

Hi
I need to sum the difference between budget and actual but only where we can compare like mont 1 to 4

MonthBudgetActual
11000500
220001000
320001500
41000800
53000 
64000 
72000 
83000 
92000 
105000 
111000 
122000 
Total280003800
1 ACCEPTED SOLUTION
DOLEARY85
Resident Rockstar
Resident Rockstar

Hi,

 

You could try something like the measure below to only calculate if the actual field is not blank:

 

Measure = if(isblank(CALCULATE(sum('Table'[Actual]))),blank(),CALCULATE(sum('Table'[Budget])-CALCULATE(sum('Table'[Actual]))))

View solution in original post

2 REPLIES 2
joaoribeiro
Impactful Individual
Impactful Individual

Hi,

You can use the CALCULATE function and filter the rows where the actual is blank, as shown below:

Difference = 
CALCULATE(
SUMX('Table', [Budget] - [Actual]),
NOT ISBLANK('Table'[Actual])
)

Result:

joaoribeiro_0-1680263965143.png

 


Find more details in:
https://learn.microsoft.com/en-us/dax/calculate-function-dax

DOLEARY85
Resident Rockstar
Resident Rockstar

Hi,

 

You could try something like the measure below to only calculate if the actual field is not blank:

 

Measure = if(isblank(CALCULATE(sum('Table'[Actual]))),blank(),CALCULATE(sum('Table'[Budget])-CALCULATE(sum('Table'[Actual]))))

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.