Calculate Percent of Total (distinct_count)

Hi,

I’m triying to calculate the porcentage of total of unique users. The problem is Percent of Total doesn’t work for distinct count.
Also I tried distinct_count(customerId)/sumOver(distinct_count(customerId), [Range_customers])

It’s possible to calculate this?

Attached you can find the column that I’d like to obtain (Percentage).

Thanks

1 Like

Hi @KLIKIN, assuming you are trying to get the:
distinct count for each range/the total distinct count

Then it looks like your calculated field is pretty close. I believe if you remove the partition (Range_customers) from the sumOver, that will give you the overall total in the denominator instead of the total for each range. For example:
distinct_count(customerId)/sumOver(distinct_count(customerId), [])

I hope this helps!

Hi @KLIKIN
you can try
percentOfTotal(sum(distinctCountOver({customerId},[Range_customers],PRE_AGG)))
BR

Thanks ErikG the problem is Range_customers is a calculated_field and is causing an error in the formula

@Kelseykl Hello Kelsey, I would like to seek your expert on this. This formula works when there is (customerID) divided by (range). How about when the (customerid) is divided by (range) and more conditions like (range) and (week) or (range) and (month)?