PercentOfTotal for Distinct Count - Overcounting in sumOver

I’m trying to calculate percentOfTotal for distinct_count , which is not supported. I have seen the solution distinct_count / sumOver(distinct_count) but sumOver(distinct_count) is overcounting compared to what sum(distinct_count) would return if nested aggregation was allowed. How can I resolve the duplication?

Hi afryc,

To help me better understand the issue, can you please confirm if this is how you are performing your calculation?

distinct_count(col_1)/sumOver(col_1,col_2,PRE_AGG ))

Here is documentation on level-aware calculations that you may find helpful.

Thanks!

Hi @afryc,

We have not heard back from you regarding your question. We would still like to help. If this is no longer relevant after seven days, we will archive the question.