Forum Discussion
Filters Selected as Text with multiple selections
- 4 years ago
I was able to figure it out. Below is the DAX Measure that worked. I teamed up ISFILTERED and HASONEVALUE in the first step, and then if it doesn't pass that step as TRUE, then it moves on to an AND statement which will allow for the multiple. Thanks for all your help
Filter Text = IF( ISFILTERED('Date'[End of Week]), CONCATENATE(MIN('Date'[Date]), CONCATENATE(" - ", MAX('Date'[Date]))), IF( ISFILTERED('Date'[Month Name]) && HASONEVALUE('Date'[Month Name]), CONCATENATE("Month: ", SELECTEDVALUE('Date'[Month Year])), IF( AND(ISFILTERED('Date'[Month Name]), ISFILTERED('Date'[Month Name])), CONCATENATE("Month: ", CONCATENATE(MIN('Date'[Month Year]), CONCATENATE(" - ", MAX('Date'[Month Year])))), IF( ISFILTERED('Date'[Day]), CONCATENATE(MIN('Date'[Date]), CONCATENATE(": ", MAX('Date'[Date]))), "YEAR-TO-DATE" ))))
dbrandone Can you share screenshots or more specifics on all the filters you have on the page?
I find CONCATENATEX to be a handy function when displaying filter selections at top of page - it lets you show all the values that are selected when multiple values have been selected.
Not sure what you mean by Date range would show as "April 2018 - October 2021" ??? What do you expect or want it to show instead? If you have a filter on the Date table, the MIN and MAX should return the values within all the filter ranges... Do you have a [Month Year] column?
You may need to try something like:
Month Range Selected =
VAR _minDate = MIN(Date[Date])
VAR _maxDate = MAX(Date[Date])
VAR _minMMYY = MINX(FILTER(Date, Date[Date] = _minDate), Date[Month Year])
VAR _maxMMYY = MAXX(FILTER(Date, Date[Date] = _maxDate), Date[Month Year])
RETURN
_minDate & " - " & _maxDate
I was able to figure it out. Below is the DAX Measure that worked. I teamed up ISFILTERED and HASONEVALUE in the first step, and then if it doesn't pass that step as TRUE, then it moves on to an AND statement which will allow for the multiple. Thanks for all your help
Filter Text =
IF(
ISFILTERED('Date'[End of Week]),
CONCATENATE(MIN('Date'[Date]),
CONCATENATE(" - ", MAX('Date'[Date]))),
IF(
ISFILTERED('Date'[Month Name]) && HASONEVALUE('Date'[Month Name]),
CONCATENATE("Month: ", SELECTEDVALUE('Date'[Month Year])),
IF(
AND(ISFILTERED('Date'[Month Name]), ISFILTERED('Date'[Month Name])),
CONCATENATE("Month: ",
CONCATENATE(MIN('Date'[Month Year]),
CONCATENATE(" - ", MAX('Date'[Month Year])))),
IF(
ISFILTERED('Date'[Day]),
CONCATENATE(MIN('Date'[Date]),
CONCATENATE(": ", MAX('Date'[Date]))),
"YEAR-TO-DATE"
))))- AllisonKennedy4 years agoCommunity Champion
dbrandone Well done! You are spot on with the && HASONEVALUE but shouldn't need the AND() function:
Filter Text = IF( ISFILTERED('Date'[End of Week]), CONCATENATE(MIN('Date'[Date]), CONCATENATE(" - ", MAX('Date'[Date]))), IF( ISFILTERED('Date'[Month Name]) && HASONEVALUE('Date'[Month Name]), CONCATENATE("Month: ", SELECTEDVALUE('Date'[Month Year])), IF( ISFILTERED('Date'[Month Name]), CONCATENATE("Month: ", CONCATENATE(MIN('Date'[Month Year]), CONCATENATE(" - ", MAX('Date'[Month Year])))), IF( ISFILTERED('Date'[Day]), CONCATENATE(MIN('Date'[Date]), CONCATENATE(": ", MAX('Date'[Date]))), "YEAR-TO-DATE" ))))