cancel
Showing results for 
Search instead for 
Did you mean: 
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
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

MPPC 2023 PBI Carousel

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors
Top Kudoed Authors