Get startedGet started for free

Creating calculated fields

1. Creating calculated fields

This is a table with the G20 countries and the average years spent in school for the 25 to 34 age group from 1970 to 2015. To create a new calculated field, you go to the analysis tab and create a calculated field. You enter the name of the field here and in the space below you write the formula. Let’s say we wanted to get the difference between these two columns to better analyze the gender inequality in different countries. We would simply subtract with no special Tableau function. We have to switch this new measure from sum to average. Through sorting we see that Saudi Arabia has the largest difference. Calculated fields can always be edited by going to their drop down. Tableau has built in documentation for their functions. Let’s look one up - like POWER - which lets you raise a field to a certain power. Now this table is focused on the mean years men spend in school across age groups. Although having this metric separated is useful, I now want a new column for the average across age groups for men. I’ll add up the 5 age groups to do this and divide by 5. Note that this won’t be a weighted average because each group has different amounts of people. And let’s drag it into view and try to visualize it. To simplify, I’m going to focus on the year 2015 and get rid of the other age groups. In the show me feature, I’ll select the treemap. In a treemap, each rectangle represents a dimension and its size is proportional to a measure. In our case, each country has a rectangle proportional to the years spent in school. We see USA has the highest average and India has the lowest average.

2. Let's practice!