Forum Discussion
Largefinger
4 years agoFrequent Visitor
Calculating Measures Totals after if statement
Hi All, I need some help with this dax measure. I am passing data through an if statement and getting the correct result at the row level, however, I can not work out how to calculate the total...
- 4 years ago
Ashish_Mathur
Super User
4 years agoHi,
Does this measure work?
Spatial Conf - Tons achieved in planned location =
var actual = CALCULATE(SUM('Actuals -Webbar'[MetricValue]),'Actuals -Webbar'[MetricSubtotalCode] = "Prod Ore To ROM"||'Actuals -Webbar'[MetricSubtotalCode] = "Dev Ore To ROM")
var planned =CALCULATE(SUM('Plan 1'[bogged_tonnes]),'Plan 1'[CLASS] ="STOPE"|| 'Plan 1'[CLASS] ="DEV",'Plan 1'[Is above cut off grade]=1)
var If_statement =
if(planned>0,
if(actual>=planned,
planned,
actual)
)
var Result = sumx(VALUES(Locations[LocationCode]),If_statement)
return ResultLargefinger
4 years agoFrequent Visitor
Yes, It does. The results are in the table above and chart above; I cannot get the total right, though.
The actual and planned variables are calculated out in different measures; I just thought I would show the details in case there was something that I was missing with a sumx vs sum.
- Ashish_Mathur4 years ago
Super User
I am confused about your response. Does my measure work or not? If it does not, then share the link from where i can download your PBI file.
- Largefinger4 years agoFrequent Visitor
Sorry I missed read your response.
Unfortunately, it doesn't work as expected.
- Ashish_Mathur4 years ago
Super User
Share the download link of your PBI file.