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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Helper II

## 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

 Month Budget Actual 1 1000 500 2 2000 1000 3 2000 1500 4 1000 800 5 3000 6 4000 7 2000 8 3000 9 2000 10 5000 11 1000 12 2000 Total 28000 3800
1 ACCEPTED SOLUTION
Super User

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]))))
2 REPLIES 2
Kudo Kingpin

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:

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

Super User

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

#### Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

#### Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

#### Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors