Shaping Data with Aggregations
Objectives
At the end of this module, you will be able to:
- Define and describe the purpose of aggregating data.
- Add and configure an aggregate step in a flow.
- Evaluate the aggregated results in the flow.
When preparing data for analysis, you may have encountered situations similar to these:
- Do you have data that you want to combine with another table, but the rows are not at the same level of detail?
- Do you have more detailed data than what your analysis needs or requires?
- Do you want to improve performance with your data or reduce the size of its output?
- Aggregating your data would resolve each of these situations. This module will demonstrate how to use an aggregate step in Tableau Prep Builder to adjust the granularity of your data.
Aggregate data to change its granularity
Granularity and aggregation
Data preparation in Tableau Prep Builder often involves shaping or restructuring the data so it can be analyzed effectively. Often, the problem with the structure has to do with the granularity, or level of detail, of the data. To change the degree of granularity, you can aggregate the data. Let's explore what it means to aggregate data.
You can change the granularity of data that doesn't have any date or time fields. For example, if we’re looking at voter turnout, we can get the average voter turnout at the level of state; or state and voting district; or state, voting district, and age bracket.
Aggregation options
Aggregating numerical fields
You can use many different mathematical operations to aggregate numbers, including:
- Sum, Average, and Median
- Count and Count Distinct
- Minimum and Maximum
- Standard Deviation and Standard Deviation Population
- Variance and Variance Population
- Percentile
- Aggregating non-numerical fields
Aggregating numbers, such as sales amounts and shipping costs, is common, but you can also aggregate strings or dates. Perhaps you want a count of the countries that a worldwide non-profit agency serves, or want the latest date that a laboratory test was performed. To aggregate dates and strings, you can use operations such as the following:
- Count and Count Distinct
- Minimum and Maximum
- Percentile
Create an aggregate step in the flow
Now that you know what it means to change the granularity of data by aggregating it, how do you aggregate data in Tableau Prep Builder? You can create an aggregate step anywhere in a flow, after connecting to and adding at least one table to the flow.