问题
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.
回答1:
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.
来源:https://stackoverflow.com/questions/56513032/why-date-is-dimension-rather-than-measure-in-tableau