The employment of data visualization proves to be an effective means to comprehend complex datasets and efficiently provide insights. In order to produce powerful visual representations in Tableau, it is essential to have a thorough grasp of the fundamental principles of dimensions and measures. In this piece of writing, we will delve into the basics of dimensions and measures within the Tableau framework and uncover their crucial role in creating visual representations and conducting data analysis.

What are Dimensions and Measures?

Tableau distinguishes between dimensions and measures to represent different data types and use them differently in visualizations. Data fields originate from the columns within your source of data. Every field(column) automatically receives a specific data type (e.g. integer, string, date) as well as a designated role, either as a Discrete Dimension or Continuous Measure (the most prevalent), or a Continuous Dimension or Discrete Measure (less frequent).

Dimensions

  • Fields that are used to provide categorization and contextual
  • Portray qualitative (non-quantitative) properties or characteristics that can be expressed in words.
  • Used to effectively organize, categorize, segment, and reveal the details in your data

Examples: Names, Designations, Timeframes, Places, or Groupings

Measures

  • Fields that provide numerical or quantitative information
  • Has the potential to be evaluated, consolidated, or computed
  • Aggregation techniques such as sum, average can be applied
  • By default, when you add a measure to the view in Tableau, it automatically applies an aggregation (sum) to it.

Examples: Sales, Profit margins, Discounts or Quantities

In the next section, we will explain the dimension and measure through a demonstration on Tableau.

Figure 1. A snapshot of a dataset

Figure 1. shows a dataset about road accidents which has different fields such as CrashID, State, Month, Year, Crash Type, Speed Limit and so on. When we load a dataset into Tableau, the data fields are automatically organized into dimensions and measures.

Figure 2. How Tableau automatically assign Dimensions and Measures

Example 1: Let’s calculate the count of accidents by gender.

In that case,

  • Crash_Data (Count) – Dimension
  • Gender – Measure

So, we can generate a simple view by dragging the dimensions and measures into the column shelf and row shelf as below.

Figure 3. Creating a simple view

Can I Convert Measures to Dimensions and vice versa?

Yes, it is possible to convert measures to dimensions and vice versa depending on the requirement. The default behaviour of Tableau is to recognize and classify all numerical variables as Measures. However, there may be instances where we need to transform these variables into Dimensions, which is also possible to achieve.

To convert a Measure Variable into a Dimension, simply right-click on it and select the option “Convert to Dimension” as demonstrated in the Figure 4. below. Follow the same to convert a Dimension to a Measure by selecting the option “Convert to Measure”.

Figure 4. Converting a measure to a Dimension

After the conversion, you will see the “Age” in the Dimensions as below.

Why do we need these conversions?

Measures into Dimensions

In certain situations, if you wish to analyse the data from a different perspective or add more categorical variables to your visualisations, converting measures into dimensions in Tableau might be helpful.

  • Useful when we want to analyse the data based on different categories or create subsets for further exploration.
  • When you want more diverse enhanced visualization options
  • Provides flexibility in applying filters and pivoting the data
  • We can effortlessly combine measures with other dimensions to get a better understanding of the connections between various factors by transforming measures into dimensions.

Dimensions into Measures

When using Tableau to do calculations, aggregations, or statistical operations on categorical data, it may be required or advantageous to convert dimensions to measures. Several factors should be taken into account before converting dimensions to measures.

  • May conduct a number of quantitative analyses on the categorical attributes
  • Allow us to aggregate and summarize data
  • Enable us to perform statistical calculations on categorical data

NOTE: Before converting dimensions to measures, it’s crucial to take the nature of the data and the precise analytical requirements into account. Not all dimensions can be converted or converted if meaningful, and the choice should be made based on the objectives of the analysis as well as the connections between the categorical data and the numerical computations you want to do.

Example 2: Let’s say that you want to explore the age (not the age group), most vulnerable to road accidents.

If you just drag the “Age” Measure to column, Tableau will automatically create an aggregation: SUM (Figure 5.).

Figure 5. Age as a Measure

Measures are important if we want to perform some calculations such as SUM, AVERAGE, COUNT, MIN or MAX. Figure 6. Shows the calculations that you can perform.

Pro Tip: In Tableau, you can right-click on the measure and drag it to the column or row shelf. This action will give you a Drop Field window with options to choose the desired calculation as below.

Figure 6. Drop field window

However, this is not the requirement. Therefore, we can convert the “Age” to a “Dimension” and then create a view (Figure 8) by dropping “Age” and “Crash_Data (Count)” in to Rows and Columns.

Now we can easily recognize that 17-year-old are the most vulnerable to road accidents.

Figure 7. Age as a Dimension

Best Practices and Tips:

Keep these best practices in mind to use Tableau’s dimensions and measures effectively:

  1. To ensure accurate representation and analysis, select the appropriate data type (dimension or measure) for each field.
  2. Determine if a field should be a dimension or measure by understanding the level of depth and granularity of your data.
  3. To ensure accurate calculations, periodically examine and validate the aggregate settings of the measures.

 

The Data School
Author: The Data School