Dimensions and Measures
When Tableau users add a data field to a chart, they need to be able to direct the way that the data fills out the chart. For example, you may want a field to be the sum value of bars in a bar chart, -or, you may want the field to label different bars as separate categories. The simplest visual data analytics software might not give you a choice: all number data will only be treated as measures to aggregate(eg. the height of bars), and all text data will only be used as column headers and categories(the different bars). But what if you want the count or frequency of text data summed in your chart? Or maybe you have a number field that you want to be column headers? Tableau accommodates these different behaviors by assigning two field roles, Dimension and Measure.
Dimensions behave like discrete categorical data while Measures behave like continuous quantitative data.
If a field is a Dimension, Tableau will treat the data in that field like words. Most often the data within Dimension fields are used as column or row headers. Tableau automatically assigns strings and Boolean fields as Dimensions. Dimensions are colored blue for easy recognition. Note that the Measure Names is a built-in Dimension field.
If a field is a Measure, Tableau will do some aggregate math on the data in that field. Most often, the data within Measure fields is treated like continuous quantitative data, and used to fill the body of the chart. Tableau automatically assigns number data fields as Measures. Measures are colored green for easy recognition. Note that the Number of Records is a built-in Measure field.
Most of the time, you will want your text fields as Dimensions and your number fields as Measures. Every once-in-a-while you will be glad that Tableau lets you switch it up. Here are few common situations for breaking the normal rules:
- A four-digit number representing year (or any other sequence date, like day-of-year). Make sure that sucker is a Dimension.
- A numeric Medical Record Number (MRN), Patient ID, or National Provider Identifier (NPI). I guess they are made up of numbers, but you do not want them treated like numbers.
- A boolean ‘flag’ field such as Present on Admit(1=Yes, 0=No). Should be a Dimension
- Ranking or Ordered Index (e.g. 1st, 2nd,3rd place, etc,). Often diagnosis and procedure codes are ordered. Dimension.
- Numeric data codes like NDC codes, DRG codes, ICD-9 (but not ICD-10). All dimensions.
- Age would typically be a measure, but if you wanted to use age as ‘bins’ to show how it impacts another measure value (such as Average Hours of Sleep by Age), then Age should be treated like a discrete Dimension.
- Sometimes Tableau will think dollar amounts (e.g. $9.99) are text fields and Dimensions, -especially if there are lots of empty values. No.No.No.