Now You See It, Now You Don't Button

Have you ever wanted to create a dynamic button? It will appear only when a certain option in a drop-down (or Parameter) is selected? In Kevin Flerlage's (of the Flerlage Twins) youtube video here, he demonstrates how to create a dashboard to dynamically show and hide filters based on parameters. One caveat to this method, is that you can't put all of these filters into a collapsible container. (It's already in one collapsible container so I think it has an issue with putting a collapsible container in a collapsible container.) This method is only for dashboards that have filters on the canvas and these will take up visual real estate. Normally I like to put filters into a collapsible container to conserve space.


I recreated his button method in my own public dashboard here. In this link, I include the dashboard where I attempt to put them into a collapsible container. The issue is that this container always shows the button you want to hide when you expand it.


Here is what the button function looks like;


When you select Other Factors from the first drop-down, a button appears. When you click on the button, a new filter displays allowing you to further filter the dashboard by Category or Ship Mode. Then the button changes in order for you to collapse this filter.


How to Create this Dashboard


One helpful way to learn a technique is to recreate it yourself. This is what I did in order to learn Kevin's dynamic filtering from the link above.


Problem Statement: As a manager, you want to know what could be impacting your profits for the last year. You want to see the profits by Segment, Category and Ship Mode.


First you will need to create a bar chart on a worksheet (named Profit by Segment) with the Order Date as your Columns, Segment and Sum of Profit as your Rows. Be sure to filter your dashboard by the most recent year.


Create the following Parameters;


Category or Ship Mode Parameter



View Profit by Parameter



Next, create a bar chart on a second worksheet (named Other Factors) with Order Date as your Columns and Sum of Profit as your Rows.

Create the following Calculated field and place this calculation before the Profit pill on your Rows shelf.


Category or Ship Mode

IF [Category or Ship Mode Parameter] = 'Ship Mode' THEN [Ship Mode]

ELSE [Category]

END



Create the below Calculated field and place it on the Filters Marks card of both worksheets.


Parameter Filter

[View Profit by Parameter]


Check this filter by Segment on your Profit by Segment worksheet and then have it checked with Other Factors on the other worksheet. Place both of these worksheets in a Vertical container on a new dashboard. Place the View Profit by Parameter on the dashboard.

Your Parameter Filter calculated field will allow sheet swapping to occur in this dashboard. (Great article by Andrew Watson regarding what Sheet Swapping is.)


Now we need to create a Button worksheet. On a new worksheet, change the Mark Type to Shape. Create the following Calculated field;


Show Button Calc

IF [View Profit by Parameter] = 'Segment' THEN NULL

ELSE "Click to Drill-down"

END


Place this calculation on the Shape Marks card and on the Label Marks card. Select a button shape for this image. Refer to this link if you are unsure of how to use/create Custom Shapes.

Put this worksheet on your dashboard, underneath your View Profit by Parameter filter. You may need to go back to your Button worksheet to adjust the Size slider as needed.


Drag another container onto your dashboard and make it floating. Right-click on this container and select Add a Show/Hide button. On the Edit Button menu, select Image Button from the Button Style drop-down. I used one I manipulated in Snag It to add the text "Click to Close".

For the Item Hidden image, I selected a Blank shape.


I placed the Category or Ship Mode Parameter inside this floating container. I moved this container to be below the Button worksheet. I also moved the button for this collapsible container overlap the Button in the Button worksheet. I had to adjust the size of the Button image to completely block out the other Button. Now when you publish this dashboard, you can click on the Button to expand or collapse the second parameter.

430 views0 comments