Hi everyone,
I have two tables in my dataset :
- Customers contains my customers and their attributes (customer_id, customer type, country, …)
- Product Sales contains one row for each sale recorded (customer_id, product category, month)
- Both tables are joined by the customer_id field.
I have created a simple measure in order to count customers in the Product Sales table :
- Nb customers = count(distinct customer_id)
Now I want to calculate the ratio of customers of each product category compared to the total number of customers in my base and I can’t find a way to do it.
Considering a total number of customers of 300, the end result should look like this :
Number of customers | Total number of customers | Ratio | |
---|---|---|---|
Product category A | 150 | 300 | 50% |
Product category B | 100 | 300 | 33% |
Product category C | 200 | 300 | 66% |
And obviously, if I add a filter to select only a subset of customers (customer_country = ‘UK’ for example). I would like this table to update accordingly
Is there an Holistics champion somewhere who knows how to do this ?