Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
sp_mike
Helper II
Helper II

Filter may have maxiumum two values selected

I have a filter on (let say) category:

 

cat1

cat2

cat3

cat4

 

In this filter the user can only select one or two values. In this case it does not make sense to select more and one of my visuals will become useless and confusing.

 

For my use case this makes perfectly sense.

So I have two questions:

1. Can I limit the values selected in my category filter?

 

2. A better solution, can I "see" when more that two category's are selected (so I can hide a visual)? 

 

I tried to find a Dax function to count the selected fields in a filter so I can so a kind of "If numbOfFilter > 2 then....."

1 ACCEPTED SOLUTION

Can't you do a simple measure using a distinct count and then applying a filter 

Visual filter = 
VAR vFilterCount =
	DISTINCTCOUNT(filterTable[filterColumn])
RETURN
IF(vFilterCount <= 2;1;0)


Then apply a visual filter on the measure that it has to be 1

View solution in original post

3 REPLIES 3
Nathaniel_C
Super User
Super User

Hi @sp_mike ,

I believe that your best option is to create a text box next to the slicer, and let the users know to is the max for a good presentation.
Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




I'll try to find another solution. I want to make it as monkey proof as possible.

But thanks for your suggestion.

Can't you do a simple measure using a distinct count and then applying a filter 

Visual filter = 
VAR vFilterCount =
	DISTINCTCOUNT(filterTable[filterColumn])
RETURN
IF(vFilterCount <= 2;1;0)


Then apply a visual filter on the measure that it has to be 1

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.