Getting percentages of total from a count distinct

Hi All,
I have what is on the first table, and I want to create what is on the second table. I am not sure how to go about this. Note that the second table displays the percent contribution of each letter to the total. Thanks!

Letter id (count distinct)
A 1
B 2
C 1
D 2
E 4
Letter Percentage of Total
A 10%
B 20%
C 10%
D 20%
E 40%

You might need to play around with calculation levels / partitioning and aggregations but you can do something like this.

percentOfTotal(avg(distinctCountOver({id},[{letter}],PRE_AGG)))

2 Likes