Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

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....."

  • 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

3 Replies

  • Nathaniel_C's avatar
    Nathaniel_C
    Icon for Community Champion rankCommunity Champion

    Hi Anonymous ,

    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

    • Anonymous's avatar
      Anonymous
      Not applicable

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

      But thanks for your suggestion.

      • adambhappy's avatar
        adambhappy
        Icon for Resolver II rankResolver II

        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