PMG Digital Made for Humans

Average Calculation in Tableau

2 MINUTE READ | September 27, 2016

Average Calculation in Tableau

Author's headshot

null null

null null has written this article. More details coming soon.

Last updated: November 2021

There’s a bit of a misconception about how Tableau calculates average numbers. I’ve seen analysts struggle with this seemingly easy calculation.

Let’s use Tableau Superstore data and calculate Average Sales by Weekday. The common way would be to drop the date into rows field and then use AVG Sales calculation, like below.

The problem is that Tableau calculates average sales numbers based on each occurrence of the sale. Looking deeper we can see that we had multiple Order IDs and then multiple products within those order IDs as shown in one day sample below.

Tableau takes all sales occurrences and creates an average for all of them. So automatic AVG aggregation in Tableau will do SUM (Sales) / COUNT (Sales). If we wish to calculate an average per day (or weekday) we do need to make an extra calculated field since we want to have AVG aggregation as SUM (Sales) / COUNT (Days). How do we do this?



First, create a calculated field below, this will get us to a total daily sales.  This calculation uses Level of Detail expressions which basically allow us to set the specific level of detail to run the aggregations, regardless of the filters or other levels of detail in the view.

Then we can use this total daily calculation to add to our visualization that has Weekday or Order Date in it and change the aggregation to an AVG to see the desired results. Below shows how results vary from Tableau’s default AVG Sales calculation and our new AVG Daily Sales. Tuesday, for example, had only one sales occurrence, so the numbers match up but as you can see other days produce totally different results due to multiple sales events.

Stay in touch

Bringing news to you

Subscribe to our newsletter

By clicking and subscribing, you agree to our Terms of Service and Privacy Policy

And now you know. Happy analysis.


Related Content

thumbnail image

Get Informed

PMG’s Predictive Dashboard Wins Innovation Award

1 MINUTE READ | September 28, 2021

thumbnail image

Get Informed

The Road to Recovery for the Travel Industry

5 MINUTES READ | November 19, 2020

thumbnail image

Get Informed

Facebook Details Approach to Mobile Industry Changes

4 MINUTES READ | August 31, 2020

thumbnail image

Get Inspired

Considerations for Reengaging New Online Customers

1 MINUTE READ | April 29, 2020

thumbnail image

Get Informed

EMEA Search Trends Amid COVID-19

8 MINUTES READ | April 28, 2020

thumbnail image

Get Informed

A Permanent Shift Into Retail Media

1 MINUTE READ | April 23, 2020

thumbnail image

Get Informed

Social eCommerce is The Darling of Cyber Weekend

4 MINUTES READ | December 2, 2019

thumbnail image

Get Informed

Reports of Amazon Clean Room Draws Attention of Advertisers

2 MINUTES READ | September 4, 2019

thumbnail image

Get Informed

PMG Shares Thoughts About Rumored Amazon Data Clean Room

1 MINUTE READ | August 28, 2019

thumbnail image

Get Inspired

Working with an Automation Mindset

5 MINUTES READ | August 22, 2019

ALL POSTS