I have these two tables:
A data table...
ImaginaryData =
DATATABLE (
\"Fruit\", STRING,
\"Colour\", STRING,
\"Amount\", INTEGER,
{
The ALL
function removes all filter context. Try it with ALLSELECTED
instead. That will preserve your slicer selection while removing the table visual's filter context.
If you use this (note I didn't specify a column):
%Total =
DIVIDE(
SUM( ImaginaryData[Amount] ),
CALCULATE(
SUM( ImaginaryData[Amount] ),
ALLSELECTED( ImaginaryData )
)
)
Then you should get this result:
The reason it doesn't work if you do ALLSELECTED(ImaginaryData[Fruit])
is that the Colour
filter context still exists, so you don't pick up the other fruits because those are all different colors than the row you are evaluating on.
I used following measure and it works as expected:
%Total =
CALCULATE(DIVIDE(sum(ImaginaryData[Amount]),
CALCULATE(SUM(ImaginaryData[Amount]),ALLSELECTED(ImaginaryData))))