• About Us
    • New York
  • Work
  • Capabilities
  • Careers
  • Technology
  • Blog
  • Contact Us
  • About Us
    • New York
  • Work
  • Capabilities
  • Careers
  • Technology
  • Blog
  • Contact Us
September 27, 2016

Average Calculation in Tableau

Posted by Val Karkauskas

There is a bit of misconception about how Tableau calculates average numbers. I have 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.

First

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.

 

second

 

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.

third

 

 

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.

 

fourth

 

And now you know. Happy analysis.

Interested in working with us? See our open analytics roles here.

AnalysisanalyticsAverage CalculationTableau
Previous
Next

Latest White Papers

  • Shifting Plans for 2020 & Beyond
  • Game On: How Brands Can Log Into A Diverse Multi-Billion Dollar Industry
  • What CCPA Means For Brands
  • How Google is Improving Consumer Data Privacy
  • Ways to Prepare for the Cookieless Future
  • See all White Papers

Featured Posts

  • Ad Age Names PMG #1 Best Place to Work in 2021
  • MediaPost Names PMG Independent Agency of the Year
  • PMG Client Portfolio Trends During Amazon Prime Day 2020
  • A Closer Look at the Congressional Big Tech Market Power Report
  • What to Know About Reddit

Categories

  • Consumer Insights
  • Content
  • Creative Design
  • Data Analytics
  • Development
  • Digital TV & Video
  • Ecommerce
  • Industry News
  • Local
  • Mobile
  • Paid Search
  • PMG Culture
  • Programmatic & Display
  • SEO
  • Social Media
  • Structured Data
Fort Worth

2845 West 7th Street
Fort Worth, TX 76107

Dallas

3102 Oak Lawn Avenue
Suite 650
Dallas, TX 75219

Austin

823 Congress Avenue
Suite 800
Austin, TX 78701

London

33 Broadwick Street
London
W1F 0DQ

New York

120 East 23rd Street
New York, NY 10010

Get in touch

(817) 420 9970
info@pmg.com

Subscribe to the PMG Newsletter
© 2021 PMG Worldwide, LLC, All Rights Reserved
  • Contact
  • Privacy Policy
 Tweet
 Share
 Tweet
 Share
 Tweet
 Share
 LinkedIn
We and our partners use cookies to personalize content, analyze traffic, and deliver ads. By using our website, you agree to the use of cookies as described in our Cookie Policy.