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

Measure with condition not showing Total

I need help with a measure 

if(SUM(SAP[Del depot Vol]) - SUM(SAP[del plant Vol]) < 0,0,SUM(SAP[Del depot Vol]) - SUM(SAP[del plant Vol]))
I want it to input zero if the cell is negative but I used the above dax and its not showing total
see image below

 

 

crowntybass_0-1686130405117.png

 

1 ACCEPTED SOLUTION

@crowntybass 

Only Truck No New is in the filter context of the visual. The other two columns are summarized by sum hence they are represented as implicit measures not as columns. Please try

Depot Actual Volume =
SUMX (
SUMMARIZE (
SAP,
SAP[Truck No New],
"@DepotVol", SUM ( SAP[Del depot Vol] ),
"@PlantVol", SUM ( SAP[del plant Vol] )
),
IF([@DepotVol] < [@PlantVol], 0, [@DepotVol] - [@PlantVol] )
)

 

View solution in original post

3 REPLIES 3
tamerj1
Super User
Super User

Hi @crowntybass 

you can follow this pattern 

Depot Actual Volume =
SUMX (
SUMMARIZE (
SAP,
SAP[Column1],
SAP[Column2],
SAP[Column3],
"@DepotVol", SUM ( SAP[Del depot Vol] ),
"@PlantVol", SUM ( SAP[del plant Vol] )
),
IF ( [@DepotVol] < [@PlantVol], 0, [@DepotVol] - [@PlantVol] )
)

 

where Column1, 2, 3 etc.. are the columns that compose the filter context of the visual. Could be one or more columns. 

Thank you for this

The subtraction didn't happen, and the condition also

crowntybass_0-1686133185768.png

 

Depot Actual Volume =
SUMX (
SUMMARIZE (
SAP,
SAP[Truck No New],
SAP[Del depot Vol],
SAP[del plant Vol],
"@DepotVol", SUM ( SAP[Del depot Vol] ),
"@PlantVol", SUM ( SAP[del plant Vol] )
),
IF([@DepotVol] < [@PlantVol], 0, [@DepotVol] - [@PlantVol] )
)

 

@crowntybass 

Only Truck No New is in the filter context of the visual. The other two columns are summarized by sum hence they are represented as implicit measures not as columns. Please try

Depot Actual Volume =
SUMX (
SUMMARIZE (
SAP,
SAP[Truck No New],
"@DepotVol", SUM ( SAP[Del depot Vol] ),
"@PlantVol", SUM ( SAP[del plant Vol] )
),
IF([@DepotVol] < [@PlantVol], 0, [@DepotVol] - [@PlantVol] )
)

 

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