Dynamically show and hide visuals in Tableau and Power BI
How many times have you been put off by the appearance of a noisy graph, as soon as you open a dashboard? While there are instances where a more complex approach could be required, sometimes the answer is as simple as: Don’t show it when it is cluttered! Here is one simple technique to dynamically hide a visual in both Tableau and Power BI.
Take the below dashboard for example, using Superstore data to show the user the sales by category over time. Since no categories are selected by default in the line chart, the several subcategories make the clustered bar chart representing profit appear crowded and difficult to gain any insight from at first glance.
However, a simple tweak to these visuals, to make the profit visual only appear once a category is selected could help make this dashboard much easier to read.
Step 1: Click on Dashboard → Actions on the menu bar and create a new sheet filter action.
- Step 2: Edit the filter action.
- Change the name of your filter (Good practice)
- Select your source sheet. (This is the visual which on selection will cause the action)
- Choose ‘Select’ as we want this action to run when we click on the visual.
- Select the target sheet. (This is the visual that will appear and disappear based on selection)
- Choose ‘exclude all values’ as we want the target visual to disappear once the selection is cleared.
- In this example we want to filter only target the subcategories and not the date, hence we need to specify the columns which will filter by selection.
- Step 1: Create a summary table for sub-category. (This is required specifically for this used case as we need the category filter to work on subcategory but ignore the year-quarter selected)
- Step 2: Build a relationship between the new table and the base table
- Step 3: Create a measure on the original table which provides the value 1 when a single category is selected.
- Step 4: Add the measure as a filter to your Sub-category visual
- Step 5: Remove the background and border of the Sub-Category visual.
Just like that, we have the same result in Power Bi