cancel
Showing results for
Did you mean:
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

1 ACCEPTED SOLUTION
Super User

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] )
)

3 REPLIES 3
Super User

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.

Frequent Visitor

Thank you for this

The subtraction didn't happen, and the condition also

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] )
)

Super User

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] )
)

Announcements

Power BI September 2023 Update

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

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

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!

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