Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tableau: Average by Dimension

Tags:

tableau-api

I would like to average N by Type for values of Inst

My data is set up as:

Type, Inst, N
A, A1, 4
A, A1, 13
A, A1, 13
A, A2, 4
A, A3, 5
B, B1, 4
B, b2, 10

So I would like to see a table (or bar chart) with A: 13, B:7. Any suggestions? If I put AVG(N) in rows and Type in columns I get A: 7.8, B:7

The problem is that Tableau is averaging all N per Type, but I want the numerator to be the total N for the Type while the denominator is the number of unique Inst within that Type

like image 496
As3adTintin Avatar asked May 03 '26 12:05

As3adTintin


2 Answers

Create a calculated field desired_avg as

{FIXED [Inst] : SUM([N])}

put it in the sheet .

select aggregation as AVG and not SUM

Let me know if that worked !

like image 94
minatverma Avatar answered May 07 '26 09:05

minatverma


Define the following calculated field

Sum(N) / countd(Inst)
like image 20
Alex Blakemore Avatar answered May 07 '26 11:05

Alex Blakemore



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!