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
MarcoT
Frequent Visitor

Subtract a constant from a measure

I'm trying to create a measure on DAX that have to subtract 2 measures from a constant (that is 14). The problem is that when I calculate it it duplicates the results row. Here's the formula:

Missed flows = (14 - CALCULATE( DMSFact'[# Not Available] ) )-'DMSFact'[Dealer_TOT_Y]

where 

# Not Available and Dealer_TOT_Y are two count measure:

Dealer_TOT_Y =
CALCULATE(COUNT('DMSFact'[Dealer Int])
,'DMSFact'[Dealer Int]="Y"
,GROUPBY('DMSFact','DMSFact'[Dealer Code]))

 

# Not Available =
CALCULATE(COUNT('DMSFact'[Flag NotAvailable])
,'DMSFact'[Flag NotAvailable]="Y"
)

 

The result I want to display is the Missed flows for each dealer, in such a form:

MarcoT_3-1652253235053.png

Insted I get this:

MarcoT_2-1652253202748.png

 

 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @MarcoT 
Please use

Missed flows =
VAR NotAvilable = [# Not Available]
VAR Dealer = [Dealer_TOT_Y]
RETURN
    IF (
        NOT ISBLANK ( NotAvilable ) || NOT ISBLANK ( Dealer ),
        14 - NotAvilable - Dealer
    )

View solution in original post

1 REPLY 1
tamerj1
Super User
Super User

Hi @MarcoT 
Please use

Missed flows =
VAR NotAvilable = [# Not Available]
VAR Dealer = [Dealer_TOT_Y]
RETURN
    IF (
        NOT ISBLANK ( NotAvilable ) || NOT ISBLANK ( Dealer ),
        14 - NotAvilable - Dealer
    )

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