Last week was tough, wasn’t it? I hope you had enough time to take a deep breath and you are ready to start with this week’s topic: Dimensions and Measures. And no worries, this blog provides only a short lesson ;). But nevertheless, the concept of dimensions and measures is fundamental to gain a deep understanding of how Tableau works!
This blog is a part of the “Becoming a Tableau Desktop Specialist Series”. Check out the further posts to learn more about it:
- Create and Save Data Connections
- Connecting and Preparing Data
- Becoming a Tableau Desktop Specialist – Part 3: Dimensions and Measures
Dimensions and Measures
When you open the authoring interface you can see your data fields on the left side. Tableau automatically assigns the data fields to either dimensions or measures.
Dimensions contain qualitative and categorical information (such as names, dates, or geographical data). They determine the level of detail in the view, that means measures will be aggregated on this level. This is why we also call a dimension the independent variable. While a single measure gives no suitable information, dimensions add context to this (or any) measure.
When you add a (discrete (more about this next week)) dimension to your view, you will get a blue pill or a header. How can we recognize headers? If you create a header you can mark the separate titles. Another hint becomes visible when you turn on the row dividers (not to be confused with grid lines).
Measures contain quantitative, numeric values. When you add a measure to your view, you’ll typically get a green pill that creates an axis. I have already mentioned that the measure will be aggregated over the dimensions or the level of detail in the view. This is why a measure is also called the dependent variable. Every time you bring in a measure, Tableau aggregates this measure by default.
Compared to headers, you can only mark the whole axis and not single values.
To wrap it up, we’ve said that dimensions are texts, dates or geographic fields and measures are numeric values. That’s it? No, that would be too easy… 😉
Numeric Values as Dimensions
Dimensions do not necessarily have to be texts, dates or geographic fields. An obvious exception is an ID-number. It makes no sense to aggregate ID-numbers. So, if Tableau wrongly treats the ID-number as a measure, you can easily change this by dragging the field to the other dimensions.
This action will change the default setting and from now on the data field is classified as a dimension.
There might also be cases, where you exceptionally want to use your measure as a dimension (and vice versa). In these cases, you don’t have to change the default setting. For example, you can ask yourself how often each discount rate was given. Therefore put ‘Discount’ on row and convert it to dimension and say ‘discrete’ (I’m sure you’ve realized that the pill changed the color. Again: stay tuned to learn about the why in next week’s post).
Every discount rate is only shown once and creates a header. Now you can put ‘Number of Records’ on Text. As you can see both fields are numeric and the discount rate is the independent variable, this is why we would call the discount rate in this view a dimension.
Texts or Dates as Measures
Now let’s do it the other way round. This time our measure contains text values but still functions as a measure. Therefore, we create a calculated field to categorize customers based on the average discount rate, which looks like the following:
Drag ‘Customer Name’ to rows and your new measure on Text (I filtered the view down to one product to keep things small and simple.). Your measure (notice the ‘AGG’ in front of the field name) shows text values for each Customer Name (the dimension in the view).
There is one last thing I wanted to add: If you write down the calculation from above without ‘AVG’, it will be computed on row level and Tableau will automatically assign your calculated field to dimensions. Why? Because text values will be classified as a dimension by default. But defining the classification the way we did (using aggregations in the IF-clause) will create a measure.
Fascinating, isn’t it?
- Getting Ready for the Tableau Desktop Specialist Exam – Going Back to Basics by Marian Eerens
- Dimensions and Measures Intro by tableau
- Tableau Fundamentals: Dimension vs. Measure by evolytics
- Dimension vs. Measure: What’s the Difference? by yseop
- Dimensions ans Measures, Blue and Green by tableau
- Dimension vs Measure in Tableau by tekslate
I hope this blog gave you a short but sufficient insight into the topic. I appreciate your feedback, you can reach out to me on Twitter or in the comments below.