I'm struggling to create a number of hierarchical bar charts that will act as filters.
The purpose is to give the user quantitative data about their choices before they select which values are included or not.
Consider we have a handful of levels (for sake of argument, let's call them State, County, City, meaning they can be represented with SuperStore).
The behavior I would like to see:
Each level will be expressed as a barchart (think Sales).
For every level, clicking on an inactive element will activate it.
Clicking on an active element will inactivate just that item (think IN/OUT if we're talking sets).
This is my critical issue: it has proven to be extremely difficult since I can't seem to make a Set Action that with just "flip-flop" the status of an element.
Thoughts?
The secondary behavior is each level should cascade to the all levels beneath it. So if the user has selected only Michigan, only Michigan Counties and Cities will show.
This shouldn't be difficult if I have correct Sets from the higher level (see above).
The third and final issue is I will need a RESET button and possibly a reset per level. I don't think this will be difficult: there is already much written on this matter.
ESSENTIALLY what we are looking at is multiple layers of Tableau relevant multi-value filters, but expressed in bar charts rather than boxes without context.
I suspect this has been written up somewhere before-- any redirection is much appreciated!
@Ayinde Hammed @Jim Dehner @Ken Flerlage @Kevin Flerlage
OK, you're right that a set/set action won't quite work because you can't change how the set action works--it will either add the item to the set or remove it. But we can use a parameter to act as a sort of set.
I've created two sheets -- Level 1, showing sales by Region and Level 2, showing sales by State. Then I created a string parameter called Level 1 List. The idea is to populate this parameter with a list of values. For example, if the list reads |Central|West|, then Central and West are "on" and the other two are "off". What we want to do is set up our view so that when we select a region, it will either add it to the list or remove it, depending on whether or not it's already in the list. For that, we'll use three calcs:
Level 1 Item
// Item to be added or removed from the level 1 list.
"|" + [Region] + "|"
Level 1 List New
// Values to update level 1 list with.
IF CONTAINS([Level 1 List], [Level 1 Item]) THEN
// Already in the list. Remove it.
REPLACE([Level 1 List], [Level 1 Item], "")
ELSE
// Not in the list. Add it.
[Level 1 List] + [Level 1 Item]
END
Level 1 Filter
// Keep if related region is in the parameter.
IF CONTAINS([Level 1 List], [Level 1 Item]) THEN
"Keep"
ELSE
"Exclude"
END
Use Level 1 Filter to control the color on the Level 1 sheet and use it as a filter on the Level 2 sheet. Also, drop Level 1 List New on the detail card of the Level 1 sheet (so we can use it in a parameter action). Then put everything on a dashboard.
Now create this parameter action which will update the Level 1 List parameter with the value of the calculated field shown earlier.
Now, as you click, the bars will toggle to be "on" or "off". One issue with it is that it keeps the bars selected which makes it difficult to tell what's going on. To correct that, I use the trick at the end of the following blog: https://playfairdata.com/how-to-make-a-boolean-toggle-in-tableau/. It's just this tricky little filter action:
When a view gets filtered, it removes any mark selections, so this just tricks it into filtering the view to remove the selection.
See attached.