Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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,

1 ACCEPTED SOLUTION

@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

hnguy71_0-1664716744639.png

 

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

hnguy71_1-1664716929040.png

 

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

hnguy71_2-1664716991342.png

 

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

hnguy71_5-1664717384781.png

 

 

5. Repeat for the second bookmark.

hnguy71_7-1664717479513.png

 

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

hnguy71_8-1664717600453.png

 

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:


2022-10-02_08h35_42.gif

 

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





Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

View solution in original post

8 REPLIES 8
PaulDBrown
Community Champion
Community 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
colour.png

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

#B3B3B300

So the measure is:

backround.png

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

overlay.gifoverlay1.gif





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Shaurya
Memorable Member
Memorable 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
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?

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

hnguy71_0-1664636304155.png


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

hnguy71_1-1664636445559.png


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

hnguy71_2-1664636477830.png

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





Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!
Anonymous
Not applicable

Hi @hnguy71 ,

 

Thanks for the idea, & i do belevie to some extent i will resolve my query

Here is bit more breif about mu query

Himanshu17_0-1664648304991.png

if you see Currently i have selected default and below that card 1 is there which represent column 1 value, so when i click on click here to get card 2 then my second card pops up. 

 

So if i change slicer value to someting else from default, my card 2 should diss appears, it is possible to that consierding i have more than 100 unique keys

 

Thanks 

@Anonymous To be honest, I'm confused about your request hehehe. will you ever only have two columns to choose your value from? Will you always only have two cards? How does the 100 keys fit into the picture?

 

Can you run me through your scenarios?

 

Scenario 1: When selecting "default", I should have two cards available. Card 1 is Column1, Card 2 is Column2. When I press a button, I want to be able to switch between the values of Column1 and Column2. 

 

Scenario 2: When selecting "A", I should have two cards available. Card 1 is Column1, Card 2 is Column2. When I press a button, I want to be able to switch between the values of Column1 and Column2. 


Scenario 3: When selecting "B", I should have two cards available. Card 1 is Column1, Card 2 is Column2. When I press a button, I want to be able to switch between the values of Column1 and Column2. 

Is this correct?



Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!
Anonymous
Not applicable

Hi  

I am sorry if I have confused you,  i will try to reframe my problem again.

Data: 

Key

Column 1

Column 2

A

Some Text 1

Some text XXX

B

Some Text 2

Some text YYY

C

Some Text 3

Some Text ZZZZ

D

Some Text 4

Some Text qqq

 

Now, this is my landing page

 

Himanshu17_0-1664699655537.png

 i have selected key A in slicer and value "Some Text 1"  is displayed inside the card 1

Now, i have created one bookmark "Click here to generate card 2" if i hold ctrl+click here then, this is how my dashboard will look like 

if you see card 2 pops up and its value is "Some Text XXX"

second step.PNG

Now here, lets say if i change my filter value from A to C

But my dashboard looks like someting like this 

step 3.PNG

here in above image

Card 1 Value is "Some Text 3" but card 2 is still there, i want if slicer value is changed than card 2 should get hidden (it should not display untill i click on 'click here to generate card 2' bookmark)

 

So again, if i change slicer value from B to C or any other value Card 2 should not be displayed unitil i click on 'click here to generate card 2' bookmark.

 

Hope this time  i am able to explain my issue 

Note: Considering i have 100 unique keys

 

Thanks 

@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

hnguy71_0-1664716744639.png

 

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

hnguy71_1-1664716929040.png

 

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

hnguy71_2-1664716991342.png

 

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

hnguy71_5-1664717384781.png

 

 

5. Repeat for the second bookmark.

hnguy71_7-1664717479513.png

 

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

hnguy71_8-1664717600453.png

 

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:


2022-10-02_08h35_42.gif

 

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





Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.