Hope everyone doing great.!
In Tableau, all other BI tools and relational databases in general, understanding the concept of dimensions and measures play a very important role. All fields are majorly categorized into measures and dimension.
Let’s understand each one of them in detail with some examples:-
In general, those fields which are quantitative in nature or we can say numerical in nature are considered as measures in Tableau.
for e.g. :- Sales, Profit, discount etc.
but few time back one of my colleague who was an intern, out of the curiosity asked me “if all numerical fields are measures then why fields such as postal code, date etc are placed under dimensions in Tableau”
Yes, that is one of the basic and very important questions if somebody want to understand dimensions and measures in very depth.
So, let me redefine my definition, measures are those fields which are numerical in nature and on which we can perform some aggregation like sum, average, but in case of postal code, aggregation like avg, sum etc. won’t make any sense.
There is a lot more in measures to understand but first lets see what are dimensions.
Those fields which are qualitative in nature, or to elaborate more, those fields which contains categorical information like in string (segments, category, product name etc.), Boolean (true false condition), geographical (country, city, state, postal code etc.). Also, these are the fields on based on which we perform aggregation like region wise total sales, top 10 profit wise products etc.
but what about dates? yes, date and date-time fields are also dimensions.
Visual representation of dimensions and measures#
If you are looking at a view in Tableau Desktop and you’re not sure whether a field is a measure or a dimension, a quick visual cue is that measures are aggregated: and dimensions are not: .
But there are exceptions:
- If the entire view is disaggregated, then by definition no field in the view is aggregated. See Disaggregating Data.
- If you are using a multidimensional data source, fields are aggregated in the data source and measures fields in the view do not show that aggregation.
But there are many fields which may question our definition of dimensions and measures. Let’s see those.
Non Numeric Measures
When we create some calculated fields then it placed under dimension and measures based on its formula. so whether it will be considered as dimension or measure, it purely depends on what is in the calculated field formula.
Let’s take an example to understand this much better.
Suppose we want to calculate the profitability w.r.t dimension selected. So, our calculated field would be
and this will produce output as Profitable or Non-Profitable which is a string value, when you click OK, it will be placed under measures, but why so?
Earlier we saw that all string fields are dimensions, but NO, in case of calculated fields it depends on whether any kind of aggregation is being used in formula or not. In this case sum(profit) is used, so if any aggregation is present, it will be considered as measures irrespective of its output data type.
Also, if the formula would be IF [Profit] > 0 THEN ‘Profitable’ ELSE ‘Non-Profitable’ END then it will be considered into dimension as there is no aggregation used.
Can we manually change them?
Yes, you can manually convert dimension into measures and vice versa either by dragging them into dimension shelf or measure shelf or by right clicking on the filed and and choose ‘convert to dimension’ or ‘convert to measure’
Thanks for reading this, I hope this will be useful to you.
Love to hear your feedback, query if any.
Don’t forget to subscribe for more upcoming Thought articles.