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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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