Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Hide and Show based on Slicer selection

Hi All,

 

Based on slicer selection my card should get hid and show. In below eg. If i select ID = 1 then my card will display "Yes" in the status and card should be visible. If i select ID = 2 then my card should get Hide. And If i select ID=3 then card should display as "Yes".

 

Same with the table If i select ID as 1 or 3 then table should show all details and if i select ID as 2 it should get hide.

OR in other words:

Status = Yes then show

Status = No Hide

 

If i select "Show All" option in slicer then both slicer and table should get hide.

 

Is there a way to achieve this functionality? Is it possible to hide and show based on Filter selection?

 

Thanks in Advance

Prakash

14 Replies

  • avatorl's avatar
    avatorl
    Icon for Impactful Individual rankImpactful Individual

    There is no easy way to show/hide visuals depends on slicer selection. What you can do:

    1) vote for an idea https://ideas.powerbi.com/forums/265200-power-bi-ideas?query=slicer%20hide%20visual
    2) if your list of slicer values is short and predifined (like your 1, 2 and 3  options) then use buttons and bookmarks instead of slicer.
    3) you can hide card data and category caption using conditional formatting and making font color same as backgroud color. Probably you'll be able to hide table as well using contitonal formatting and maybe measures that return BLANK() depends on slicer selection. This is just a workaround.

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

    Anonymous  You can create a measure to show the status using below dax syntex. Also turn off the category on the card showing the value.

     

    Status =
    (
    IF(HASONEFILTER(Data_Type_Selected[ID]),
    SWITCH(SELECTEDVALUE(Data_Type_Selected[ID]),
    "1", "YES",
    "2", "",
    "3", "NO"

    ),
    BLANK()
    )

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi negi007 ,

       

      Thanks for your response. But if i have more no. of ID's like 10,000 ID's i cant give it manually so do we have any alternate way for the Status column like status = "Yes" Show else Status = "No" the hide.

       

      Thanks

      Prakash

      • avatorl's avatar
        avatorl
        Icon for Impactful Individual rankImpactful Individual

        Then the only way for you - use measures that return empty string (for a card) or blank() (for a table) and conditional formatting to hide all visible elements of a card / table. You don't need write a measure like the above with one row of DAX per each ID, you can use a column in your table.

        A measure should return you either visible value or empty string. And you'll need some measures for conditional formatting to hide elements like Category in a card by changing font color to background color.

  • ScottyR's avatar
    ScottyR
    Frequent Visitor

    Kind of a workaround, but I used the "Advance Card" visual add-on (free) to put conditions on the card and change the text color to match the background when the condition was met. Not sure if this helps your situation or not.