Tableau Class Notes: To Aggregate or Not to Aggregate? Part 2

Data

Tableau Class Notes: To Aggregate or Not to Aggregate? Part 2

As a follow-up to my prior blog post, I wanted to explore an additional use case for aggregation in Tableau: joining together data that might be at different date levels. It’s the same premise—you have two data sources at two levels of detail (e.g. row-level transactions vs. regional goals; employee-level vs. team-level), but the steps to aggregate that data are slightly different.

In this example, we have weekly profit data, as well as daily sales data. Our end goal is to return three columns with our daily sales rolled up to the weekly level so that we can compare it against our profits:

weekly and daily profit data in Tableau

Since one data source is at the weekly level, and one is at the daily level, adding an aggregation will be necessary to return data at the correct level.

When Aggregation is Necessary

A rule of thumb for aggregation: your data sources must be aggregated so that they match the data source with the highest level of aggregation. In our example, we have our data split out by week and by day. We couldn’t reliably break our weekly data down to the daily level since we don’t know what days each profit occurred on, so we should aggregate our daily data to the weekly level.

Once we add an Aggregate step, we need to specify what fields we are grouping by and what we are aggregating:

grouped and aggregated fields in Tableau

Click on the word Group next to your data type icon to change your “Group By” level to “Week Start” so it matches our Weekly target data. If you want to read more about how Tableau treats our different options, check out this video from my colleague, Katie! Next, we can add a Clean step and join our two data sources together on our two date fields to get our final data source:

clean aggregated data in Tableau

Hopefully this clears up any questions you have about how to tackle situations where you might have data at two different date levels. Cleaning it up in Prep before you bring it into Tableau Desktop will make your life infinitely easier by minimizing the need for calculations. Thanks to Kent Sloan for assistance on this blog, and thanks for reading!

More About the Author

Liz Jensen

Analytics Consultant
Alter Your Analysis: Women’s World Cup Match Wins In this second installment of Alter Your Analysis, I am tackling Alteryx’s Weekly Challenge 169: “Using the values in the attached file ...
Alter Your Analysis: Highest Average Retail Rating While attending my first Alteryx training with InterWorks’ own Steph Kennedy, she said something that still sticks in my brain each ...

See more from this author →

Subscribe to our newsletter

  • I understand that InterWorks will use the data provided for the purpose of communication and the administration my request. InterWorks will never disclose or sell any personal data except where required to do so by law. Finally, I understand that future communications related topics and events may be sent from InterWorks, but I can opt-out at any time.
  • This field is for validation purposes and should be left unchanged.

InterWorks uses cookies to allow us to better understand how the site is used. By continuing to use this site, you consent to this policy. Review Policy OK

×

Interworks GmbH
Ratinger Straße 9
40213 Düsseldorf
Germany
Geschäftsführer: Mel Stephenson

Kontaktaufnahme: markus@interworks.eu
Telefon: +49 (0)211 5408 5301

Amtsgericht Düsseldorf HRB 79752
UstldNr: DE 313 353 072