How to roll numbers up in Tableau for aggregation?

Viewed 21

I have a data structure issue. I have a problem where I need to roll up my data within tableau so that aggregated numbers do not skew in a certain manner.

Example of current data

ID    Model_Number  Value
123         fff         2
123         ggg         2 
123         hhh         2
123         uuu         2
124         yyy         5
124         qqq         5
124         eee         5
Avg:         NA       3.28

Ideal state of data and aggregation

ID     Value 
123       2
124       5
Avg       3.5

As you see since the data is at two different grains the aggregated number (avg) will be different. I would like to roll up my numbers to the distinct value of ID and then calculate my average which will result in a different (correct in my context) aggergated number.

1 Answers

Here is one calculated field that could help.

{ FIXED [ID] : AVG([Value]) }

This will give you the avg value by ID. You can then use a grand total(avg) to get the 3.5

enter image description here grand total changed to avg

Related