Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

ISFILTERED to set conditional slicer

Hi community,

 

I have folloed the steps in this post

https://exceleratorbi.com.au/show-or-hide-a-power-bi-visual-based-on-selection/#comment-87248

It almost achieved everything I want except for a small issue...

 

I am trying to build a report with a simple Matrix and 3 slicers, and scenario like

 

Initially, there's no visual shows up (Except for 3 slicer, say, Division, Year, Month) until a slicer (Division) is selected. 

When there's nothing seleced, display a message by Card saying 'You must select...'

Message = IF( ISFILTERED('Table'[Column]),"","You must first select a Operating Division from the filter to see the results")

 

I implemented the steps like create a measure "Check Filter" = CALCULATE(IFIISFILTERED('Table'[column]),1,0))

and a Measure "MakeTransparent" = IF(ISFILTERED('Table'[Column]),"#FFFFFF00","White") this is set for conditional formating the background color of Card.

 

These all worked fine; the only thing is, when the slicer is set to "Select All", it shows the Message.

I guess it's because the CheckFilter does not recognize the "ALL" so it make it looks like none filter applied. 

 

How should I do to make the "Select All" display all the values? 

 

Thank you!

  • Hi, Anonymous 

    According to your description and document link, I also followed the blog to do the same demo as yours, then I got the same problem.

    Then I found that when I turn off the “Select all” option, and select all manually, the card chart can display the correct value, like this:

     

     

    Then I understand the problem is caused by the “select all” button. After some test, I figured out a method to solve this problem, you can try my steps:

    1. Create a Slicer table:
    Slicer =
    
    UNION ( ROW ( "Category", "Select all" ), DISTINCT ( 'Table'[Category] ) )
    1. Create these measures:
    Check Filtered =
    
    IF(ISFILTERED(Slicer[Category]),
    
    IF(
    
        SELECTEDVALUE('Slicer'[Category])="Select all",1,
    
        IF(
    
            MAX('Table'[Category]) in ALLSELECTED(Slicer[Category]),1,0)),0)
    Make Transparent =
    
          IF(
    
             ISFILTERED('Slicer'[Category]),
    
             "#FFFFFF00",
    
             "White"
    
          )
    Message =
    
       IF(
    
          ISFILTERED('Slicer'[Category]),
    
          "",
    
          "You must first select a Product Category from the slicer to see the results"
    
       )
    1. Change the filter on the Matrix like this:

     

    And you can get what you want, like this:

    You can download my test pbix file here

     

    Best Regards,

    Community Support Team _Robert Qin

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

2 Replies

  • mwegener's avatar
    mwegener
    Icon for Most Valuable Professional rankMost Valuable Professional

    Hi Anonymous ,

     

    I think this is not possible, because from DAX point of view "Select All" and not filtered is the same.

     

     

  • v-robertq-msft's avatar
    v-robertq-msft
    Icon for Community Support rankCommunity Support

    Hi, Anonymous 

    According to your description and document link, I also followed the blog to do the same demo as yours, then I got the same problem.

    Then I found that when I turn off the “Select all” option, and select all manually, the card chart can display the correct value, like this:

     

     

    Then I understand the problem is caused by the “select all” button. After some test, I figured out a method to solve this problem, you can try my steps:

    1. Create a Slicer table:
    Slicer =
    
    UNION ( ROW ( "Category", "Select all" ), DISTINCT ( 'Table'[Category] ) )
    1. Create these measures:
    Check Filtered =
    
    IF(ISFILTERED(Slicer[Category]),
    
    IF(
    
        SELECTEDVALUE('Slicer'[Category])="Select all",1,
    
        IF(
    
            MAX('Table'[Category]) in ALLSELECTED(Slicer[Category]),1,0)),0)
    Make Transparent =
    
          IF(
    
             ISFILTERED('Slicer'[Category]),
    
             "#FFFFFF00",
    
             "White"
    
          )
    Message =
    
       IF(
    
          ISFILTERED('Slicer'[Category]),
    
          "",
    
          "You must first select a Product Category from the slicer to see the results"
    
       )
    1. Change the filter on the Matrix like this:

     

    And you can get what you want, like this:

    You can download my test pbix file here

     

    Best Regards,

    Community Support Team _Robert Qin

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.