Here's a good 'un, using a parameter to highlight.
I know, create a bar chart, make a parameter, use a boolean output, stuff the pill onto the colour marks, and watch as each of your selected attributes instantly flashes up your chosen highlight colour
That wasn't so hard was it?
Now make a tree-map:
- Set marks to square
- Add Category and Sub-Category to the text in this order, to create a hierarchical tree-map
- Then add Sales to the size
- And finally, your discrete calculated attribute to the colours, exactly as you did in the earlier bar chart
But, oh dear, each time you select an item, Tableau moves the item out of sequence. Sure, it is being highlighted, but the sequence is not retained, why?
Well, this is all down to how your marks are laid-out. You see, when using the rows and columns, Tableau is able to use these to define the primary output, so bars and lines already have a pre-defined structure, any further attributes placed on the marks card, calculated or otherwise are only secondary to the layout.
But, when the rows and columns are not used, the marks card becomes Tableau's only source for determining layout, so all dimensions are used in the layout, with Tableau then splitting the final underlying table to include those items inside the boolean filter, and those that are out. So in the case of the hierarchical map, a further dimension has been added: Category, Sub-Category and boolean filter.
So how do we get around this?
By using a boolean output that Tableau will not use as part of the layout, by using a calculated measure:
- Create a parameter from the Sub Category dimension, call it p_SubCat
- Add an 'All' attribute too, move this to the top of the parameter list
- Create the above calculated field, call it something like highlight
- Create your treemap
- Place your highlight field onto the colours and set a corresponding value for the outputs
- Sit back and watch as adjusting your parameter hilights the selected without altering the layout