Why date is Dimension rather than Measure in Tableau?
Asked Answered
C

1

6

According to the definition of Dimension and Measure in Tableau:

Dimensions contain qualitative values(such as names, dates, or geographical data).
Measures contain numeric, quantitative values that you can measure.

In my opinion, date-type data seems more quantitative than qualitative, and it can be measured.

So why Tableau treats date as Dimension rather than Measure?
Thanks for any hint.

Celestinacelestine answered 9/6, 2019 at 8:21 Comment(0)
M
10

Date fields are only treated as dimensions by default, but you can certainly use a date as measure instead.

Measures are aggregated in Tableau, so you would normally compute the max (i.e. latest) date value, or the min (i.e. earliest) data value, or perhaps the count or distinct count of a data field. You can't compute the avg or sum of dates like you can with numeric fields.

The part of the Tableau documentation you quoted is unfortunately so poorly written that is downright misleading. Whether a field is treated as dimension or measure is not determined by its datatype, but by whether you wish to compute an aggregation function summarizing the values in that field (treating the field as a measure) or whether you wish to use the field to partition or slice data records prior to aggregation (treating the field as a dimension). Treating a field as dimension is exactly like using that field in a GROUP BY clause in a SQL statement.

Its unfortunate that such a an important concept is currently so poorly explained in the documentation which has otherwise improved greatly over the last few years. I imagine it was an attempt to make a simple introduction that veered from being simplified into actually being wrong.

A field in Tableau has a few fixed attributes, such as its name, data type, aliases and definition (such as the reference to the corresponding database column or calculation). Other attributes of a field may have default values in the data source that can be nonetheless be changed anytime that field is used on a particular worksheet - e.g., the default numeric or date formatting, whether the field is displayed as discrete or continuous or whether it is treated as a dimension or measure.

So when people talk about dimensions in Tableau, that is short hand for "fields that are being treated as dimensions in the current view". Since that is kind of long winded, people just talk about dimensions and measures, but that gives the misleading impression that the choice of role is intrinsic to the field instead just a default. Many times that distinction isn't critical, but with dates in particular, they can be used many different ways.

Meggy answered 9/6, 2019 at 19:44 Comment(3)
Thanks for your detailed and in-depth answer. I think I understand it better: Dimension & Measure are the variable marks of data, it depends on what you want to show and explore. Use Measure when you want to aggregate this data field.Celestinacelestine
Because Date don't support avg and sum, so you can not drag or convert it into Measure directly. But you can achieve it by create a Calculated Field, such as max([Date]).Celestinacelestine
You can convert a Date field directly to a measure. Just right click on the field once you place it on a shelf, and then choose Measure instead of Dimension. You will have to choose the aggregation function under measure, but Max() is one of the options.Meggy

© 2022 - 2024 — McMap. All rights reserved.