To implement this recipe, perform the following steps:
- Create the following measure:
Dynamic Slicer Title =
VAR __ALLTEXT = "all"
VAR __NONETEXT = "no"
VAR __DIRECTFILTERPRETEXT = "You have chosen "
VAR __POSTTEXT = " brand(s)."
VAR __CONCATENATE_TEXT = ", "
VAR __LASTCONCATENATE_TEXT = " and "
VAR __SIMPLEMULTIPLETEXT = "Multiple"
VAR __TOOMANY_MAX = 4
VAR __TOTAL_ROWS = COUNTROWS(DISTINCT(ALL('R01_Table'[Brand])))
VAR __CURRENT_ROWS = COUNTROWS(DISTINCT('R01_Table'[Brand]))
VAR __MAINTEXT =
SWITCH(
TRUE(),
__CURRENT_ROWS = __TOTAL_ROWS,__ALLTEXT,
__CURRENT_ROWS = 0 ,__NONETEXT,
__CURRENT_ROWS = 1 , MAX('R01_Table'[Brand]),
__CURRENT_ROWS < __TOOMANY_MAX,
CONCATENATEX(
TOPN(__CURRENT_ROWS - 1,DISTINCT('R01_Table'[Brand])),
[Brand],
__CONCATENATE_TEXT
) &
__LASTCONCATENATE_TEXT &
LASTNONBLANK(DISTINCT('R01_Table'[Brand]),TRUE()),
__SIMPLEMULTIPLETEXT
)
VAR __PRETEXT = __DIRECTFILTERPRETEXT
RETURN __PRETEXT & __MAINTEXT & __POSTTEXT
- On a Report page, create a Slicer visualization and place the Brand columnĀ from R01_Table in the Field area of the visualization.
- On the same Report page, create a Card visualization and place the Dynamic Slicer Title measureĀ in the Fields area of the visualization.
Experiment by choosing different items, including multiple items in the slicer, and observe how the text within the card visualization changes.