Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

How to hide card when slicer value is changed?

Hi Everyone,

I am working on sciler and card, 

KeyColumn 1Column 2
ASome textSome text
BSome TextSome Text

 

Lets say i have sclicer where i have mode 100 of fields (A, B, C...n like unique key which is i am using to filter my data)

and i have two card, in one card for column 1 values is there and on other card column 2 

So every time in slicer if i cange from A to B, 

Here are my expectation:

1. Filter Value in Card 1 (which i have done)

2. The moment I change key from A to B my second card should get hidden (So for every change in sclier key my my second card should automatically get hidden)

 

As for now

 

i am using this two button, if first button clicked then my second card appear (which is disered way of doing), and reset button to hide my second card. So instead of using reset button i want to hide my second card by changing value in slicer 

 

Note: Till now, i am abe to make show/hide button,

  • hnguy71's avatar
    hnguy71
    4 years ago

    Anonymous ,

     

    Okay! Now I understand! This is much easier and simplier.

    The other suggestion by Shaurya actually fits your criteria.

     

    Here's a walkthrough on how to accomplish it.

     

    1. Create 1 key slicer, two cards both holding each column's values, and two buttons. You should have something similar to this

     

    2. Open your Selection Pane and rename/group your objects for ease of visibility.

     

    3. Open Bookmarks Pane and create two bookmarks and rename them if needed

     

    4. To create your first set of bookmarks, click "hide" on Column2 grouping, then select the page slicer, and the two groupings together. Afterwards, select the three dots on Bookmark_Column1, and unselect "Data", and select "Selected Visuals" and then finally select "Update".

     

     

    5. Repeat for the second bookmark.

     

    6. Next, on your first button, select Action, set type as "Bookmark" and select your first bookmark.

     

    7. Repeat for the other button. Once you're done you can align and overlay your cards/buttons to look and feel like a single element. Your result should be similar to this:


     

    This would meet your 100+ unique key criteria. Let me know if this works for you.



8 Replies

  • Shaurya's avatar
    Shaurya
    Icon for Memorable Member rankMemorable Member

    Hi Anonymous,

     

    You should be able to do this by using bookmarks. You'll have to create two bookmarks, one where the slicer has value A and another with value B. Along with this, you'll have to go to View->Selection->Layer Order. You'll see all the elements on your report page. Now select the first bookmark, check if all the required cards are visible or not and then select the second bookmark and hide the card from layer order. Update the bookmark and save.

     

    Hope that helps!

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Shaurya 

      Thanks for the response, the problem is i have more the 100 keys (unique values) so can not do one by one, is there a any other work around?

      • hnguy71's avatar
        hnguy71
        Icon for Super User rankSuper User

        Anonymous you mentioned you have 100 unique keys. It's not sustainable to create 100 bookmarks and I'm sure you don't want to create that. 

        Instead... why don't you unpivot your columns and have 1 card that represents the data you want?
        For example...


        When a user selects a "unique key", you ask the formula to pick up a specific column for that specific value. Here's a sample:

        CardValue = 
        
        VAR _Key = SELECTEDVALUE('Table'[Key])
        
        // ideally you should have a key to column mapping, but this is a sample.
        VAR _ColumnNameToShow = 
            SWITCH( _Key,
                "A", "C2",
                "B", "C1",
                "C", "C2"
            )
        
        VAR _Value = CALCULATE(MAX('Table'[ColumnName]), 'Table'[Key] = _Key, 'Table'[ColumnName] = _ColumnNameToShow)
        
        
        RETURN
        
        IF(ISBLANK(_Value), "", _Value)

         

        So now... let's say I select unique key "A", I want to return Column2 string


        if I select unique key "B", I want to return Column1 string

        And the process continues dynamically all the way down to your last unique key.



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

    Here is one way...

    Set up the page with both cards and the slicer. Create a measure which returns the same colour as the backround if selection <> "A", and a transparent colour if = "A".

    In this example, the backround colour is 

    #B3B3B3

     Adding two zeros at the end of a hex code renders the colour transparent:

    #B3B3B300

    So the measure is:

    Now add a rectangular shape as an overlay for the second card, and use the measure for the conditional formatting of the fill colour: