PMG Digital Made for Humans

Average Calculation in Tableau

2 MINUTE READ | September 27, 2016

Average Calculation in Tableau

Author's headshot

Val Karkauskas

Val Karkauskas 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

AlliCampaigns & Client WorkData & TechnologyStrategyDigital MarketingCompany News

PMG’s Predictive Dashboard Wins Innovation Award

1 MINUTE READ | September 28, 2021

thumbnail image

Consumer TrendsSocial MediaPlatforms & MediaDigital Marketing

What You Need to Know About Facebook’s Latest Content Transparency Reports

4 MINUTES READ | August 30, 2021

thumbnail image

Consumer Trends

The Road to Recovery for the Travel Industry

5 MINUTES READ | November 19, 2020

thumbnail image

EMEA Search Trends Amid COVID-19

8 MINUTES READ | April 28, 2020

thumbnail image

A Permanent Shift Into Retail Media

1 MINUTE READ | April 23, 2020

thumbnail image

Social eCommerce is The Darling of Cyber Weekend

4 MINUTES READ | December 2, 2019

thumbnail image

Working with an Automation Mindset

5 MINUTES READ | August 22, 2019

ALL POSTS