While using maps, we sometimes want to show multiple colors for a single dimension on it. Let’s say, top 5 and bottom 5 states by profit in a country. An easy way to do this is by creating sets which means having a subset of data of top 5 and bottom 5 states by profit.
What are sets?
Sets are custom fields that are created within Tableau Desktop based on dimensions. They can be used to compare and ask questions about a subset of data.
There are two types of sets:
- Dynamic: The values/members in the dynamic sets change when the underlying data changes.
- Fixed: The values/members in fixed set do not change when the underlying data changes.
I’ll be using Sample superstore data-set. Connect to the set and open worksheet.
- We want to show the top 5 and bottom 5 states by profit. Let’s make two separate sets.
- Right click on States and select Create > Set. Use the Top tab to define limits on what members to include in the set. Choose top ‘5’ States by ‘Sum’ of ‘Profit’. Rename your set to ‘Top 5 States by Profit’.
- Make another set for ‘Bottom 5 States’ by ‘Sum’ of ‘Profit’. When finished, click OK.
- The new sets are added to the bottom of the Data pane, under the Sets section. A set icon
indicates the field is a set.
- In order to use these sets to colour our map, we need to create a calculated field.
- Drag the calculated field to colour. Change the colours according to your preference.
- It would be good to have labels of these States on map for it to make more sense. Let’s create a calculated field for it and drag the calculated field to Label on Marks Card.
And our map showing two sets of states by profit by different colours is ready!