How to distinct count by condition

Hi All,

I need to make a calculated field between two fields but it’s not working.
How can I resolve this?

sum(distinct_countIf({id_customer}, , {step} = ‘Payment’)) / sum(distinct_countIf({id_customer}, , {step} = ‘Waiting’)) * 100

Best Regards,

Thanks!

Hi @July - Can you please share sample data and expected output. This way we can replicate it and explore the solution.

Tagging @David_Wong @duncan @nshah-quicksight for their expert advise as well.

Regards - Sanjeeb

Hi !

I can’t upload files, but it would look something like this:

– database

id_evt id_customer step
111 1 payment
112 1 payment
113 1 payment
114 1 others
115 1 others
116 2 waiting
117 2 waiting
118 3 others

I need to calculate the conversion rate between waiting and payment

So, I need to summarize the number of different customers in the payment and waiting stages.

Ex:
sum( distinct_count (id_customer where step = ‘payment’ )) /
sum( distinct_count (id_customer where step = ‘waiting’ )) * 100 = 0.8 %

Best Regards,

July.

Hi @July - Can you try distinct_countIf in stead of distinct count and do a sumover as well like below.

sumOver(distinct_countIf({id_customer}, {step} = ‘payment’))

Hi @David_Wong @duncan - any advise on this.

Regards - Sanjeeb

2 Likes

Wow!

It is working now!

Thank you so much!