Forum Discussion
electrobrit
3 years agoPost Patron
grand total incorrect when using an IF condition
Having issues with getting matrix grand total correct when using an IF condition that if the district =1001, then sum the secondary currency else sum the local currency. Perhaps using selected value...
- 3 years ago
I figured it out for anyone else dealing with this:
Actual_Amount =SUMX(vw_districts,CALCULATE(SWITCH(MAX(vw_districts[District Code]),"1001", SUM(vw_fin_transactions[Transaction Amount Secondary]),SUM(vw_fin_transactions[Transaction Amount Local]))))
electrobrit
3 years agoPost Patron
thank you but I can't figure out how to write this with HASONEFILTER because the if statement after seems to me it's wanting to say if the sum is this, then use "this" else, use this measure. (I underlined the part I am confused about)
I am not using a value so can't have if (sum) statement. What I need is clearly calling a table field and when I tried to add the condition If (district code = 1001...-it wouldn't let me use a table)
Mine is if the district code = 1001, then use the secondary currency, else use the local currency.
What works but totals are wrong.
Actual Amount =
Actual Amount =
If(
SELECTEDVALUE('vw_districts'[District Code]) = "1001",
SUMX(vw_fin_transactions,'vw_fin_transactions'[Transaction Amount Secondary]),
SUM(vw_fin_transactions[Transaction Amount Local])
)
This is what the references you sent were showing. I can't put an If condition calling a table field.
MyMeasure2 = IF(HASONEFILTER(Table[Year]),
IF(SUM(Table[Amount])<1000,0,SUM(Table[Amount])-1000),
SUMX(FILTER(Table,[Amount]>1000),[Amount]-1000)
)
Any thoughts on this?