Forum Discussion
Use a Default Measure When Slicer is Set to 'All'
- 3 years ago
Thanks for the reply. I was actually able to get this sorted out.
What I was after, was for the visual to use a default measure, when the slicer has nothing or "All" selected. I was able to achieve this via some DAX.
You need to determine how many values the slicer has without filters, then compare to how many it has in current context:
Measure =
VAR _CountAllOptions = CALCULATE( countrows( values ( table[column] ) ), ALL() )
VAR _CountCurrentOptions = countrows( values ( table[column] ) )
VAR _Result = IF( _CountAllOptions = _CountCurrentOptions, [Default Measure], [Other Measure] )
RETURN
_Result
I had the original measure and I created 2 additional measures.
Measure 1: This measure displays the data as I want it displayed in default state (no slicer selection).
Measure 2: This is a measure that uses an IF statement. If(selectedvalue('slicer')=Blank(), Measure 1, Original Measure.