Forum Discussion
arielcedola
Helper III
6 years agoHow to set default value for slicer but enabling multiple slicer selection
Hi, I'm using RANKX to set a default value to a filter in several visuals, as follows: YearRank = RANKX(ALLSELECTED(Sales[Year]), CALCULATE(MIN(Sales[Year])),,DESC,Dense) I set the current year ...
- 6 years ago
mwegener
Most Valuable Professional
6 years agoHi arielcedola,
I use the iterator function to check the rows for the MAX year and to return a 1 accordingly.
The solution is not perfect, but it works in this scenario.
arielcedola
Helper III
6 years agoThis is the solution I was trying, it does the work too.
articleDefaultYear =
var MaxYear = CALCULATE(MAX(Sales[Year]), ALL(Sales))
RETURN
IF(
not ISFILTERED(Sales[Year]),
CALCULATE(MIN(Sales[Article]), FILTER(Sales, Sales[Year] = MaxYear)),
CALCULATE(MIN(Sales[Article]))
)articleDefaultYear is not blank must be set as visual-level filter in the table for this to show only the current year data by default (if no year is selected with the slicer) or data from the selected year/years instead.