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.

Reply
charlie7491
Employee
Employee

Subtraction is not working for me

I will like to get the difference between two measure' values
 
#AADP MAU Increase = [#AADP MAU_End] - [#AADP MAU_Start]

Individually, these show as: 
#AADP MAU_Start = 166M
#AADP MAU_End = 170M
 
But when I do the substraction, I am getting 0 or 0.00

I have tried different things, such as the below, but still get 0

#AADP MAU Increase = FORMAT([#AADP MAU_End] - [#AADP MAU_Start], "General Number")
3 REPLIES 3
charlie7491
Employee
Employee


@johnt75  has hinted at what the problem was.  The two values are start and end values that are set by filters. 

The Dax formulas are the same but the filters set different results. So the calculation is treating both as equal therefore returning 0. The solution is to use something like the below

AADP MAU_Start = calculate(sum(CustomerAndTasksView[AADP MAU]),DimDate[StartDate]=DimDate[StartDate])

AADP MAU_End = calculate(sum(CustomerAndTasksView[AADP MAU]),DimDate[EndDate]=DimDate[EndDate])
johnt75
Super User
Super User

Are there different filters being applied to the visuals showing the results ?

Try running the below in DAX Studio

EVALUATE
ROW (
    "#AADP MAU_Start", [#AADP MAU_Start],
    "#AADP MAU_End", [#AADP MAU_End],
    "#AADP MAU Increase", [#AADP MAU Increase],
    "Simple calc", [#AADP MAU_End] - [#AADP MAU_Start]
)

The start and end values come from filters. The Dax formulas are the same but the filters set different results
Start&EndScreenshot.png
So it appears that is the issue then.
Do you have any idea how I may trick it into retaining the displayed filter results so that I can get the substraction to be valid?

Helpful resources

Announcements
Microsoft Fabric Learn Together

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

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors