1

Let's consider this :

Student | Score

S1          87

S2          75

S3          52

I want to create a pie chart or horizontal chart showing what percentage of students scored more than the average score.

According to the above example, Avg(Score) = 71.33

% of students scoring more than avg(score) is 66.67% (S1 & S2)

Already gone through How to count occurrence of value and percentage of a subset in tableau public? but in that question, the comparison is against a static value rather than an aggregated value.

Community
  • 1
  • 1
coding_idiot
  • 13,526
  • 10
  • 65
  • 116

1 Answers1

1

This can be achieved using a window calculation.

Create a calculated field called 'Above Average' with the calculation

IF AVG([Score]) > WINDOW_AVG(AVG([Score])) THEN 1 ELSE 0 END

Now you can filter out your dataset to only use values where 'Above Average' > 0 and create your pie chart.

woodhead92
  • 127
  • 1
  • 14