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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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