2 Replies Latest reply on Apr 16, 2017 5:56 AM by Jeff D

Understanding how tableau calculates AVG on different dimensions

Hello,

In the attached screenshot you can see I have tried to make a calculated field.

First I have taken the sum of profit (per sub category <- according to view).

Divided by no. of product sub-category (per sub category <- according to view).

The expected result was, for the first sub category:

121651 / 1 = 121651.

But I didnt get that, rather tableau divided the first value (sum of profit on sub-category) by the no of orders on that sub-category => 121651 / 492
Why is that ?

This is my first step towards a longer goal by the way. In the end I want to calculate the difference of profit from the avg profit per sub-category as the picture indicates. Your help on the end goal will also be appreciated.

• 1. Re: Understanding how tableau calculates AVG on different dimensions

I have got one way to achieve my final goal:
SUM([Profit])-WINDOW_AVG(SUM([Profit]))
Re: Finding Difference From Reference Line and Coloring Above & Below Line

But still looking for the answer of my first problem to understand the avg calculation clearly.

• 2. Re: Understanding how tableau calculates AVG on different dimensions

Hi Mahmudur,

If you have 492 orders for [Product Sub-Category] Appliances, then:

COUNT([Product Sub-Category]) = 492

Are you looking for the distinct count?

COUNTD([Product Sub-Category]) = 1