Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Showing visual only when slicer selected

Hi everyone,

 

I have a visual that I want to display data only when the user selects a category from a slicer. If nothing is selected from the slicer, I just want a blank space. I found this post, which has a nifty little solution to this by overlaying a treemap that colours transparent when a slicer value is selected, but otherwise is opaque white to hide the visual beneath: https://insights.votivasoft.com/show-or-hide-a-power-bi-visual-based-on-selection/

 

I've tried to use this method, but my dax code doesn't recognise the hex code "#FFFFFF00" as transparent. It just reads it as white. I'm thinking that the conditional formatting only reads the first 6 characters of the hex code? I'm just not sure why this is. I've read around and it seems that other people's dax code using this method works and does indeed produce a transparent box. Does anybody have any idea why this isn't working for me or has an alternative solution?

 

Many thanks in advance for any help.

  • Hi Anonymous ,

     

    I tried the following measure for transparency at my end without SWITCH statement and it works for me:

    Make Transparent =
    IF(
    ISFILTERED(ClothingSales[Category]),
    "#FFFFFF00",
    "#FFFFFF"
    )
     
    Try this and see if it works.
     
    Also, in your measure, you are missing "#" from 2nd condition. You are just using "FFFFFF". It should be "#FFFFFF'.
     
    Thanks,
    Pragati
  • Hi Anonymous ,

     

    I wrote a blog sometime back on similar functionality. Can you check once if you are following all these similar steps:

    https://community.powerbi.com/t5/Community-Blog/Display-Custom-Message-in-the-Visual-Until-a-Selection-is-Made/ba-p/1438721

     

    If still it doesn't work, then share your pbix file by removing any sensitive information from it.

     

    Also I am wondering; if this was not working then why was the solution accepted. 🙂

     

    Thanks,

    Pragati

17 Replies

  • Hi Anonymous ,

     

    Can you share your measure please? I tried the similar scenario at my end and it works.

    Do add some screenshots as you haven't shared anything on what you are seeing at your end.

     

    Thanks,

    Pragati

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Pragati11,

       

      Thanks for your response.

       

      So here's my visualisation:

       

      And this is the measure I'm using:

       

      Here's the visualisation with my overlaid treemap (which I've made smaller so you can see how it's just opaque white). Based on the measure it should be transparent now, since a slicer value is selected, but it remains solid white.

      I know it's a problem with the transparency, as if I change the measure to show blue when a slicer value is selected, the treemap does indeed turn blue when I use the slicer.

       

      Any ideas what I'm doing wrong?

       

      Thanks very much.

      • Pragati11's avatar
        Pragati11
        Super User

        Hi Anonymous ,

         

        I tried the following measure for transparency at my end without SWITCH statement and it works for me:

        Make Transparent =
        IF(
        ISFILTERED(ClothingSales[Category]),
        "#FFFFFF00",
        "#FFFFFF"
        )
         
        Try this and see if it works.
         
        Also, in your measure, you are missing "#" from 2nd condition. You are just using "FFFFFF". It should be "#FFFFFF'.
         
        Thanks,
        Pragati
  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Pragati11 
    I have the same problem, But my Matrix Visual is made up of all measures I created. So i can not pull "Filter Selected" measure to my table visual's visual-level filter section. The filter does not give me the optipon to drop down and select "1" or "2". What should I do?   

    • Pragati11's avatar
      Pragati11
      Super User

      HI Anonymous ,

      Can you please share some screenshots here around what you are trying to do?

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hey Pragati11 , 
        Thanks for addressing the concern but can't share the screenshot. You can create simple measure>put it in table> and try to apply Filter Selected on Visual level filter on that Table Visual. It won't work, may I know why?