We will be diving deeper into advanced usage of Tableau for truth and story telling.
Students Do: Warm-Up
Let’s open up the file(s) in the 01-Stu-Warmup
folder to get started.
Groups & Sets
Let’s open up the file(s) in the 02-Ins-Groups_Sets
folder to get started.
Groups
Groups are all about categorizing entities based on the values that you want.
- In the demo, we will group both Argentina & Spain as spanish-speaking countries.
- Notice that their values will be aggregated as a group under its alias.
- In our case, we are labeling “Spanish-speaking” to the group so that we can isolate it for analysis.
General approach
There are a couple of ways where you can group values.
School’s Method
- Create a table with values.
- Select the rows you want to group.
- Hold
Ctrl
orCmd
to do multi-selection.
- Hold
- Right-click on one of the selected values, and there will be a menu which gives you a selection to create a group.
- A group will be created based on your selection, and you will see the group added on the left navigation bar.
- Rename at will by right clicking.
Alternative Method
- Right-click on the dimension you want to group on the left navigation bar, and look for
Create > Group
- It will give you a list of values where you can assign into a group. Select those values you want and use
Group
to group them.
Either way works and it is down to your personal preference on how you want to group your values.
Sets
Sets are all about categorizing entities based on a set of rules and guidelines.
- You can add distinct values and formulas to categorize your data.
- Sets are more flexible than groups where it can be drawn from multiple dimensions or even conditions.
It is not much different from grouping if you’re selecting specific values to create a set.
However, to create a set based on rules and guidelines, you will have to specify the conditions for the set explicitly.
Students Do: Movie Rental Groups and Sets
Let’s open up the file(s) in the 03-Stu-Groups_Sets
folder to get started.
Calculations
Let’s open up the file(s) in the 04-Ins-Calculations
folder to get started.
You can derive deeper insights with your own formulas to create metrics, or even change the presentation of your visualizations through logic.
- Read more on creating custom fields here: https://help.tableau.com/current/pro/desktop/en-us/calculations_calculatedfields.htm
- Tableau has its own syntax that is different from other programming languages, but it is roughly the same structure.
In our activity, we can created a “Revenue Color” calculated field that has the following if-else statement:
IF
SUM([Paid Fee]) > 10000
THEN
"High Revenue"
ELSEIF
SUM([Paid Fee]) > 5000
THEN
"Not so High Revenue"
ELSE
"Low Revenue"
END
What does the above do?
- We are labeling any value within the above conditions in the “High Revenue”, “Not so High Revenue”, and the “Low Revenue” bucket.
- This can be applied to your visualization as an additional metadata, such as colors or labels.
If you do not want to write out a very long IF statement, you can consider IIF:
IIF(SUM([Rented Days])>1000, "High Rentals", "Low Rentals", "Unknown")
COUNTD
is to count distinct values within a column: COUNTD([Customer Id])
Another quick way to do calculations is to use pre-defined calculations, under the option “Quick Table Calculation”.
- Put the selected metric to “Rows”, since rows are the individual records that you want to perform calculations on.
- Select
Difference
, and set it relative to the previous value.- This is useful especially for financial data, where you’re computing the gains and losses from previous days’ performance.
Students Do: Calculations
Let’s open up the file(s) in the 05-Stu-Calculations
folder to get started.
Maps
Let’s open up the file(s) in the 06-Ins-Maps
folder to get started.
Maps is very simple and efficient in Tableau because they have pre-defined zip codes, states, counties, and map layers within the software. They could look up zip codes and add it as a map layer within the system where you can overlay your data points.
It does mean you’ll have to update the software often to get the latest updates.
Students Do: Maps 1
Let’s open up the file(s) in the 07-Stu-Maps1
folder to get started.
- As you’re plotting against the Richter scale, do use
Magnitude ^ 10
to size earthquakes on the map.
Students Do: Maps 2
Let’s open up the file(s) in the 08-Stu-Maps2
folder to get started.
Dashboard
Let’s open up the file(s) in the 09-Ins-Dashboard
folder to get started.
We went through dashboard briefly in the previous lesson, but today we will create interactive elements on all visualizations in a single dashboard collectively.
How to create interactivity on dashboards?
- Interactivity means you can select or filter values based on your cursor’s point and click.
- First, create a dashboard with at least a couple of visualizations.
- Each visualization should be on a sheet.
- Next, under the
Dashboard > Actions...
, you can add an action that is shared across all visualization.- You can select the type of interaction such as
Hover
orSelect
, and you can select specific or all the fields to perform an action on.
- You can select the type of interaction such as
Students Do: Dashboard
Let’s open up the file(s) in the 10-Stu-Dashboard folder to get started.
Level of Detail (LOD) Calculations
Let’s open up the file(s) in the 11-Ins-LOD
folder to get started.
Level of detail (LOD) calculations are all about story telling. How much detail is enough, and whether it adds value to the ideas that you’re trying to drive?
We have 2 concepts here: aggregation vs granulation
- Aggregation means you want to showcase a bird’s eye/panoramic view of your data.
- Granulation means you want to showcase the micro view of your data.
Essentially, you are creating calculated fields to show the aggregation or granulation with your data visualization.
In the activity, we see that there is State level data, represented by the State
dimension. If I want to show the State’s profits in relation to the total profits within the United States, how should I do?
- Create a calculated field, “National Profit”.
- Use this expression:
{EXCLUDE [State] : SUM([Profit])}
- It means when I sum all the profits, I do not want to aggregate the values to the
State
level. By excludingState
, it will aggregate without consideringState
.- As we selected
State
in ourDetail
for our map, it will naturally aggregate it to the state level.
- As we selected
- This also represents the level of detail you want to go into.
- If you use
INCLUDE
, you will add that measure to the current level of detail.
- It means when I sum all the profits, I do not want to aggregate the values to the
- Use this expression:
- Create another calculated field, “Contribution to Nat’l Profit, State”.
- The calculations will include the previous calculated field, “National Profit”.
SUM([Profit]) / ATTR([National Profit]) * 100
- The
Profit
value is on theState
level, sinceState
is selected withinDetail
. - The
National Profit
would sum up every profit value, ignoringState
, and it is its own value as an attribute (ATTR).
- The
- The calculations will include the previous calculated field, “National Profit”.
Students Do: Level of Detail
Let’s open up the file(s) in the 12-Stu-LOD
folder to get started.
- You will have to use
SIGN()
function in Tableau to correct wrongly represented negative values: https://www.melovedata.com/quick-tip-use-the-sign-function-in-tableau-for-easy-color-indicators/