# Calculated field help!

Hello!

I have a calculated field to count the distinct quantity of customer who purchased products.

Example:
Distinctcountif (client_id, stage = ‘1’ and product in (‘A’, ‘B’) )

We have customers who purchased product A, other customers who purchased product B and customers who purchased both products (A and B)

In my filter, when the user selects Product A, I need to show the distinct quantity of the customer who purchased product A, when the user selects Product B in the filter, I need to show the number of customers who purchased product B, but I also need show in both situations the same customer who purchased both products.

How to create a calculated field to resolve this?

Thanks you

Hi @July ,

Can you please help me understand the requirement again? When user selects product A, the metric should return number of customer who bought the product A. Lets say this is metric1.
So when user selects Product B , metric1 will reflect number of customers who bought product B.
Now for the number of customers who bought both A and B, how do you want to report it? Is it another metric2 where we report this?

Thanks,
Prantika

I am still a bit confused on the need of the switch condition and the requirement. Can you share a sample data and visual you are looking at in the Arena?

Sharing below what I understood. Switch case will be compiled case by case, so based on your formula, none of the CL_RN is counted under B since the previous case is satisfied all gets encoded as A.

Is this what you want to compute?

If yes, how you want to represent all three categories together in a visual, since this recounts the customers and the numbers won’t match with total.

However if your computation is like :

You can modify the switch case to yield this.

1 Like