Forum Discussion
NMOORE
Helper II
2 years agoincorrect Total Selected Value alternative
Hi, I need to sum quanities differently depending on my column values. The working example is much more complex with info I cannot share so I have drafted up a basic example using the Table below. ...
- 2 years ago
Hi,
so, leave your first calculation like thisExample = VAR _A =CALCULATE(SUM('Example Table'[Quantity]),FILTER(ALL('Example Table'),'Example Table'[Type] = "Cow"))VAR _B =SUM('Example Table'[Quantity])
RETURNIF(SELECTEDVALUE('Example Table'[Type]) = "Dog" ||SELECTEDVALUE('Example Table'[Type]) = "Donkey",_B / _A,0)Add one more measure:
Example2 =
SUMX(SUMMARIZE('Example Table', 'Example Table'[Type], "Example Correct", 'Example Table'[Example]), [Example Correct])
olgad
Resident Rockstar
2 years agoHi,
I dont know if it is gonna fit your real example,
but here it is
Example = VAR _A =
CALCULATE(
SUM('Example Table'[Quantity]),
FILTER(
ALL('Example Table'),
'Example Table'[Type] = "Cow")
)
VAR _B =
SUM('Example Table'[Quantity])
RETURN
If(HASONEVALUE('Example Table'[Type]), IF(
SELECTEDVALUE('Example Table'[Type]) = "Donkey",
_A + _B,
_B
),_B+_A
)
NMOORE
Helper II
2 years agoThanks so much Olgad, just away from my work at the moment I'll give it a whirl on Monday. Cheers