Dimensions and Measures in Tableau

Learn via video courses
Topics Covered

Overview

In Tableau, dimensions and measures are two fundamental types of data fields used for creating visualizations. Dimensions represent qualitative, categorical data such as names, dates, or categories, providing context for analysis. Conversely, measures represent quantitative, numerical data like sales, quantities, or profits used for calculations and aggregations. Understanding the distinction between dimensions (qualitative) and measures (quantitative) is crucial, affecting how data is displayed and analyzed in Tableau. Mastering these concepts helps newcomers create more insightful visualizations and make data-driven decisions effectively.

What are Dimensions and Measures in Tableau?

Dimensions in Tableau:

  • Dimensions are categorical data fields that represent qualitative attributes.
  • They provide context and structure to data, allowing users to segment, group, and categorize information for analysis.
  • They are typically used on the rows and columns of a visualization, defining the axes of charts and graphs.

Measures in Tableau:

  • Measures are numerical data fields that represent quantitative values.
  • They perform calculations, aggregations, and statistical operations on the data.
  • They are typically used to create quantitative visualizations and provide a quantitative aspect to the data analysis.

For example: In a toy store dataset,

  • Dimensions would be like the different categories or labels that provide context and grouping for the data.
  • Examples of dimensions in this case could be: Toy Type (e.g., Action Figures, Dolls, Board Games) Brand (e.g., LEGO, Barbie, Hasbro) Color (e.g., Red, Blue, Green) Country of Origin (e.g., USA, China, Germany)
  • Measures in the toy store dataset would be the numerical values you can calculate and analyze. They represent the quantitative aspects of the toys.
  • Examples of measures in this case could be: Price (e.g., 10.99,10.99, 24.99, 32.50)NumberofUnitsSold(e.g.,50,100,200)Revenue(e.g.,32.50) Number of Units Sold (e.g., 50, 100, 200) Revenue (e.g., 550, 2,499,2,499, 6,500) Average Rating (e.g., 4.2, 3.9, 4.5) Profit Margin (e.g., 20%, 15%, 30%)

Using both dimensions and measures effectively in Tableau, you can gain valuable insights into the toy store's data and present the information visually compellingly.

Difference between Dimensions and Measures in Tableau

Here's a comparison chart highlighting the key differences between Dimensions and Measures in Tableau:

AspectDimensionsMeasures
TypeCategorical data fieldsNumerical data fields
RepresentationUsed on Rows and ColumnsUsed for Values
PurposeProvide context and groupingPerform calculations and aggregations
ExamplesProduct categories, Customer namesSales revenue, Quantity sold
Data TypeDiscrete or ContinuousContinuous
AggregationNot aggregated (specific values)Aggregated (e.g., sum, average, count)
VisualizationDefine axes of charts and graphsQuantitative elements of visualization
Usage in ChartsBar charts, scatter plots, pie chartsBar charts, line charts, area charts
Examples in ChartCategories on X-axis, Y-axis, etc.Sales revenue on Y-axis, etc.
HierarchiesCan be used for hierarchical groupingNot used for hierarchical grouping

Dimensions vs. Measures in Tableau: Key Differences

Dimensions and Measures are two fundamental data types in Tableau that play distinct roles in data visualization and analysis. Understanding their key differences is essential for effectively working with Tableau. Let's delve into the detailed comparison:

Data Type:

  • Dimensions: Dimensions can be either discrete or continuous. Discrete dimensions have a finite set of distinct values, like categories or labels. Continuous dimensions have infinite values, like dates or geographical coordinates.
  • Measures: Measures are always continuous data types since they deal with numerical values, which can be measured across a continuous range.

Representation in Visualizations:

  • Dimensions: Dimensions are typically used on the rows and columns shelves of visualizations. They define the axes and structure the layout of the chart or graph. Examples include bar charts, scatter plots, and pie charts.
  • Measures: Measures are used as the numerical values determining the size, position, or color of marks in a visualization. They are used for creating quantitative elements in the chart, like bar lengths, data points, or color gradients.

Aggregation:

  • Dimensions: Dimensions are not aggregated. They represent specific values and are used for organizing data. For instance, each bar represents a specific dimension value without aggregation in a bar chart.
  • Measures: Measures are usually aggregated to produce meaningful insights. Common aggregations include sum, average, count, minimum, maximum, and more. Aggregations summarize the data and present it concisely.

Usage in Calculations:

  • Dimensions: Dimensions are not used directly in calculations. They mainly provide the basis for data segmentation and grouping.
  • Measures: Measures are the primary elements used in calculations. They form the basis for creating calculated fields, which allow users to perform custom calculations and derive new insights from the data.

How to Use Parameters in Tableau?

In Tableau, parameters are dynamic inputs that allow users to control certain aspects of the data and influence the behavior of calculations, filters, and visualizations. Parameters act as placeholders for specific values that users can change, making the visualizations interactive and adaptable to varying requirements.

Create a parameter to allow users to control the discount percentage and observe its impact on sales revenue.

Step 1: Connect to Data and Load Sample Dataset

  • Open Tableau and connect to your dataset (e.g., Excel, CSV, or database) containing sales data.
  • For this example, assume the dataset includes columns like "Product Name," "Sales," and "Discount."

Step 2: Create a Parameter

  • In the "Data" pane on the left, right-click on a blank space and select "Create Parameter."
  • Name the parameter as "Discount Percentage" and set the data type to "Float" or "Decimal."
  • Set allowable values (e.g., from 0 to 1 with an increment of 0.01) to represent percentage values from 0% to 100%.

Step 3: Create a Calculated Field

  • Right-click on a blank space in the "Data" pane and select "Create Calculated Field."
  • Name the calculated field as "Discounted Sales" to indicate that it will calculate sales revenue after applying the discount. In the calculated field formula editor, use the following formula: [Sales](1[DiscountPercentage])[Sales] * (1 - [Discount Percentage])

Step 4: Add the Parameter Control

  • Drag the "Discount Percentage" parameter from the "Data" pane to the view.
  • Choose "Slider" as the parameter control type to allow users to adjust the discount percentage interactively.

Step 5: Create a Bar Chart

  • Drag "Product Name" to the "Rows" shelf and "Discounted Sales" to the "Columns" shelf.
  • Tableau will create a bar chart showing the discounted sales revenue for each product.

Step 6: Observe the Impact of the Parameter

  • Move the slider of the parameter control to adjust the discount percentage.
  • As you move the slider, the bar chart will dynamically update, showing the impact of the chosen discount percentage on the sales revenue for each product.

Step 7: Save and Share

  • Save your Tableau workbook to preserve the parameter settings and the interactive visualization. You can then share the workbook with others to allow them to interact with the parameter and explore the data.

Discrete vs. Continuous

In Tableau, Discrete and Continuous are two distinct data types used to represent different data types in your dataset. Understanding the difference between these two data types is crucial for effectively visualizing and analyzing your data.

Discrete:

  • Discrete data comprises individual, distinct, and separate values.
  • It represents categorical or qualitative data, such as categories, labels, or groups. Examples of discrete data include product categories, customer names, or regions.
  • Discrete fields are typically represented as separate, individual data points in visualizations.
  • In Tableau, discrete data fields are displayed with blue pills on the shelves (rows, columns, and mark cards).Examples of visualizations using discrete data are bar charts, pie charts, and heat maps.

Continuous:

  • Continuous data comprises infinite possible values within a given range.
  • It represents numerical or quantitative data, such as measurements, temperatures, or time. Examples of continuous data include sales revenue, temperature readings, or timestamps.
  • Continuous fields are typically represented as a continuous range in visualizations.
  • In Tableau, continuous data fields are displayed with green pills on the shelves (rows, columns, and mark cards). Examples of visualizations using continuous data are line charts, area charts, and scatter plots.

Key Differences:

  • Discrete data has individual and distinct values, while continuous data has infinite values within a range.
  • Discrete data is used for categorical or qualitative attributes, while continuous data is used for numerical or quantitative attributes.
  • Discrete data is represented as separate data points, whereas continuous data is represented as a continuous range in visualizations.

Conversion of Dimensions and Measures in Tableau

  • Converting a dimension to a measure in Tableau involves creating a calculated field that aggregates the dimension data using an aggregation function.
  • Converting a measure to a dimension in Tableau involves creating a calculated field that transforms the measure data into categorical or qualitative values.

a) Converting Dimension to Measure

Converting the "Quantity" dimension to the "Sum of Quantity" measure.

Step 1: Open Tableau and Connect to Data

  • Open Tableau and connect to your dataset (e.g., Excel, CSV, database) containing the "Quantity" dimension.

Step 2: Create a Calculated Field

  • In the "Data" pane on the left side, right-click on a blank space and select "Create Calculated Field."

Step 3: Name the Calculated Field

  • Name the calculated field as "Sum of Quantity" to indicate that it will represent the sum of the "Quantity" dimension.

Step 4: Use an Aggregation Function

  • In the calculated field formula editor, use an aggregation function like SUM() to convert the dimension to a measure. The formula should be: SUM([Quantity])SUM([Quantity]).

Step 5: Save the Calculated Field

  • Click "OK" to save the calculated field and add it to the "Data" pane.

Step 6: Use the New Measure in Visualizations

  • Drag the "Sum of Quantity" measure from the "Data" pane to the "Columns" or "Rows" shelf to create a visualization.

Step 7: Observe the Results

  • Tableau will now display the sum of the "Quantity" dimension as a measure, aggregating the data accordingly.

Example Output: Suppose you have the following dataset with the "Quantity" dimension representing the number of units sold for different products:

ProductQuantity
Product A100
Product B150
Product C80

By converting the "Quantity" dimension to the "Sum of Quantity" measure, Tableau will display the following output:

Sum of Quantity
330

In this example, Tableau has aggregated the individual values of the "Quantity" dimension (100 + 150 + 80) to create the "Sum of Quantity" measure (330), representing the total number of units sold across all products.

b) Converting Measure to Dimension

Converting the "Sales Revenue" measure to the "Sales Category" dimension based on sales ranges.

Step 1: Open Tableau and Connect to Data

  • Open Tableau and connect to your dataset (e.g., Excel, CSV, database) containing the "Sales Revenue" measure.

Step 2: Create a Calculated Field

  • In the "Data" pane on the left side, right-click on a blank space and select "Create Calculated Field."

Step 3: Name the Calculated Field

  • Name the calculated field as "Sales Category" to indicate that it will be a dimension representing different sales ranges.

Step 4: Use an IF Statement or Other Function

  • In the calculated field formula editor, use an IF statement or another function to categorize the "Sales Revenue" measure into different sales ranges. For example:

Step 5: Save the Calculated Field

  • Click "OK" to save the calculated field and add it to the "Data" pane.

Step 6: Use the New Dimension in Visualizations

  • Drag the "Sales Category" dimension from the "Data" pane to the "Columns" or "Rows" shelf to create a visualization.

Step 7: Observe the Results

  • Tableau will now display the "Sales Category" dimension based on the sales revenue ranges you defined in the calculated field.

Example Output: Suppose you have the following dataset with the "Sales Revenue" measure representing the revenue generated from different products:

ProductSales Revenue
Product A1200
Product B800
Product C4500

By converting the "Sales Revenue" measure to the "Sales Category" dimension based on the calculated field, Tableau will display the following output:

Sales Category
Medium Sales
Low Sales
High Sales

In this example, Tableau has categorized the "Sales Revenue" measure into different sales ranges based on the calculated field's logic.

Want to Explore Further? Scaler Data Science Course Delivers In-Depth Insights to Become a Skilled Data Scientist. Enroll Now!

Conclusion

  • Tableau is a powerful data visualization tool that helps users create interactive and dynamic visualizations for data analysis.
  • Dimensions in Tableau represent categorical data and provide context and structure to the data, while measures represent numerical data and are used for calculations and aggregations.
  • Parameters in Tableau enable users to control certain aspects of data interactively, enhancing the flexibility and interactivity of visualizations.
  • Using parameters in Tableau enhances interactivity by enabling users to dynamically control specific aspects of data, like filters, sorting, and calculations.
  • Converting dimensions to measures and vice versa can be achieved using calculated fields, allowing for data transformations to suit specific visualization needs.
  • Discrete data in Tableau consists of separate values, while continuous data has an infinite range within a domain.