Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.
Below is dax measure to return if anything is filtered from the slicers . I have to add an else condition if nothing is selected. Need assistance to add an else condition as indivually if I add else in all if statements, it gives me multiple else condition values.
Applied_Filters =
VAR MaxFilters = 3
RETURN
IF (
ISFILTERED ( 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Date] ),
VAR ___f = FILTERS ( 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Date] )
VAR ___r = COUNTROWS ( ___f )
VAR ___t = TOPN ( MaxFilters, ___f, 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Date] )
VAR ___d = CONCATENATEX ( ___t, 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Date], ", " )
VAR ___x = "'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Date] = " & ___d & IF(___r > MaxFilters, ", ... [" & ___r & " others]") & " "
RETURN ___x & UNICHAR(13) & UNICHAR(10)
)
& IF (
ISFILTERED ( 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Day] ),
VAR ___f = FILTERS ( 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Day] )
VAR ___r = COUNTROWS ( ___f )
VAR ___t = TOPN ( MaxFilters, ___f, 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Day] )
VAR ___d = CONCATENATEX ( ___t, 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Day], ", " )
VAR ___x = "'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Day] = " & ___d & IF(___r > MaxFilters, ", ... [" & ___r & " others]") & " "
RETURN ___x & UNICHAR(13) & UNICHAR(10)
)
& IF (
ISFILTERED ( 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Month] ),
VAR ___f = FILTERS ( 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Month] )
VAR ___r = COUNTROWS ( ___f )
VAR ___t = TOPN ( MaxFilters, ___f, 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Month] )
VAR ___d = CONCATENATEX ( ___t, 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Month], ", " )
VAR ___x = "'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Month] = " & ___d & IF(___r > MaxFilters, ", ... [" & ___r & " others]") & " "
RETURN ___x & UNICHAR(13) & UNICHAR(10)
)
Solved! Go to Solution.
To add an "else" condition in your DAX measure for the scenario when nothing is selected in any of the slicers, you can use an additional IF statement outside of the existing ones. Here's how you can modify your measure to include the "else" condition:
Applied_Filters =
VAR MaxFilters = 3
RETURN
IF (
ISFILTERED ( 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Date] ),
VAR ___f = FILTERS ( 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Date] ),
VAR ___r = COUNTROWS ( ___f ),
VAR ___t = TOPN ( MaxFilters, ___f, 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Date] ),
VAR ___d = CONCATENATEX ( ___t, 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Date], ", " ),
VAR ___x = "'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Date] = " & ___d & IF(___r > MaxFilters, ", ... [" & ___r & " others]") & " "
RETURN ___x & UNICHAR(13) & UNICHAR(10)
)
& IF (
ISFILTERED ( 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Day] ),
VAR ___f = FILTERS ( 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Day] ),
VAR ___r = COUNTROWS ( ___f ),
VAR ___t = TOPN ( MaxFilters, ___f, 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Day] ),
VAR ___d = CONCATENATEX ( ___t, 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Day], ", " ),
VAR ___x = "'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Day] = " & ___d & IF(___r > MaxFilters, ", ... [" & ___r & " others]") & " "
RETURN ___x & UNICHAR(13) & UNICHAR(10)
)
& IF (
ISFILTERED ( 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Month] ),
VAR ___f = FILTERS ( 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Month] ),
VAR ___r = COUNTROWS ( ___f ),
VAR ___t = TOPN ( MaxFilters, ___f, 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Month] ),
VAR ___d = CONCATENATEX ( ___t, 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Month], ", " ),
VAR ___x = "'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Month] = " & ___d & IF(___r > MaxFilters, ", ... [" & ___r & " others]") & " "
RETURN ___x & UNICHAR(13) & UNICHAR(10)
)
& IF (
NOT (
ISFILTERED ( 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Date] ) ||
ISFILTERED ( 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Day] ) ||
ISFILTERED ( 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Month] )
),
"No filters applied",
BLANK()
)
This additional IF statement checks if none of the slicers are filtered. If none of them are filtered, it returns the string "No filters applied". Otherwise, it returns a blank value. This ensures that you get a meaningful result even when no filters are selected.
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.
Thanks a ton! It worked!
To add an "else" condition in your DAX measure for the scenario when nothing is selected in any of the slicers, you can use an additional IF statement outside of the existing ones. Here's how you can modify your measure to include the "else" condition:
Applied_Filters =
VAR MaxFilters = 3
RETURN
IF (
ISFILTERED ( 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Date] ),
VAR ___f = FILTERS ( 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Date] ),
VAR ___r = COUNTROWS ( ___f ),
VAR ___t = TOPN ( MaxFilters, ___f, 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Date] ),
VAR ___d = CONCATENATEX ( ___t, 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Date], ", " ),
VAR ___x = "'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Date] = " & ___d & IF(___r > MaxFilters, ", ... [" & ___r & " others]") & " "
RETURN ___x & UNICHAR(13) & UNICHAR(10)
)
& IF (
ISFILTERED ( 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Day] ),
VAR ___f = FILTERS ( 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Day] ),
VAR ___r = COUNTROWS ( ___f ),
VAR ___t = TOPN ( MaxFilters, ___f, 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Day] ),
VAR ___d = CONCATENATEX ( ___t, 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Day], ", " ),
VAR ___x = "'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Day] = " & ___d & IF(___r > MaxFilters, ", ... [" & ___r & " others]") & " "
RETURN ___x & UNICHAR(13) & UNICHAR(10)
)
& IF (
ISFILTERED ( 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Month] ),
VAR ___f = FILTERS ( 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Month] ),
VAR ___r = COUNTROWS ( ___f ),
VAR ___t = TOPN ( MaxFilters, ___f, 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Month] ),
VAR ___d = CONCATENATEX ( ___t, 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Month], ", " ),
VAR ___x = "'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Month] = " & ___d & IF(___r > MaxFilters, ", ... [" & ___r & " others]") & " "
RETURN ___x & UNICHAR(13) & UNICHAR(10)
)
& IF (
NOT (
ISFILTERED ( 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Date] ) ||
ISFILTERED ( 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Day] ) ||
ISFILTERED ( 'DateTableTemplate_3c7006c1-cdf4-4313-9ad9-0bc2cfd685d9'[Month] )
),
"No filters applied",
BLANK()
)
This additional IF statement checks if none of the slicers are filtered. If none of them are filtered, it returns the string "No filters applied". Otherwise, it returns a blank value. This ensures that you get a meaningful result even when no filters are selected.
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.
User | Count |
---|---|
8 | |
8 | |
5 | |
5 | |
3 |