Bookmark Button should Activate When Conditions are met

Hello,

So here is my Scenario that i need some help with.

I need help / ideas for The Button “Click to See Trends”.

I would like this button to be activated / be usable only if the number of selections in “Statecode” slicer is Less than 3.

Because there are 23 statecodes, I dont want to display a line chart that has 23 lines. therefore I intend to limit it to any 3 statecodes that user can compare at any given point. If the selection is of more than 3 statecodes, the button should remain inactive.

Expected output:

Attaching hte Sample File for reference
button conditionaly Active state.pbix (31.9 KB)

1 Like

Bumping this post for more visibility from our experts and users.

HI @jsodhi,

While waiting for other members to jump in, I suggest using the forum search to discover if your query has been asked before by another member. Thanks!

1 Like

Hi @jsodhi

I’m not sure you can do this with bookmarks, I can’t see a way to dynamically change the destination when the Action is set to Bookmark - someone may have more insight on this! However if you make them 2 seperate pages it should work, please see PBIX at the bottom.

Created a measure for the count of states selected:

 State Count = 
 DISTINCTCOUNT( 'Data Table'[Statecode] )

Created a measure for the text of the button and set the button to use this measure for the text:

Button Text = 
IF(
    [State Count] > 3,
    "Too many States Selected",
    "Click to See Trends"
)

Created a measure to decide what page to go to and set this as the destination for the button:

Button Navigation = 
IF(
    [State Count] > 3,
    "",
    "Trends Graph"
)

Hope this helps!
button conditionaly Active state.pbix (35.5 KB)

EDIT:
Alternatively if you really needed it to be bookmarks, you could make a measure like this:

Button Colour = 
IF(
    [State Count] > 3,
    "White",
    "Black"
)

And set the font colour and border properties of the button to use this measure. Then it will “disappear” if more than 3 are selected, however technically the user can still technically click it if they hovered over the area.

2 Likes

Ha, you beat me to it @jamie.bryan I followed a similar approach.

Created a Dimension tbl for StateCode

image

Then a measure which counts how many values are selected

StateCode No Selected =
CALCULATE ( COUNTROWS ( ALLSELECTED ( 'State Codes' ) ) )

Then a conditional format measure which will hide the button when the count is above 3

Conditional Format for Trends Button =
IF ( [StateCode No Selected] <= 3, "#99B9F7", "#00000000" )

Then added the Conditional Format Measure to the Button Background, Button Border & Text Font Colour.

image

image

button conditionaly Active state for Jsodhi.pbix (35.5 KB)

2 Likes

Hey @jamie.bryan and @DavieJoe you guys are Awesome. Thank you.

I too attempted with a measure that that would change the colour of the button if more than 3 were selected. - and my last resort would have been to make it - all white or merge in background colour, which was not a satisfactory solution since anyone could accidentally click that area and end up seeing an ugly line chart

But I didnt think of creating a separate page and conditionally changing the destination - This will do the job exactly as i planned.

Thank you again

2 Likes

great solutions here - and I’m going to add one additional note for anyone finding this topic in the future - there is also the drill-through button (which would also require a second page for the drill-through action)
One of the nice things about the drill-through action is that it has a disabled state (they selected more than 3 items)

Here is the info from Microsoft on that process:

3 Likes

Thanks @Heather - I will definitely check this out.

DJ

2 Likes

Thank you @Heather

When i had attempted the use of drill through, Asfar as i can remember, it didnt work for me since i wanted the button to activate only when slicer options were selected, and this option was activating he button even when a bar, of a bar chart was clicked. and think it prompted for just a single data point selection.

@DavieJoe Please do share if it works when you attempt with drill through.

For future reference for anyone on landing on this topic, I am sharing the working sample, similar to my actual file.

button conditionaly Active state.pbix (35.7 KB)

1 Like