Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Using set analysis to generate a percentage

I'm trying to calculate what percentage of customers spending over a certain level have bought products from us.

Using this syntax I can count the number of customers spending more than £1000 based on my current selection (which is fine).

=count({$<location_id={"=sum(customer_gross_sales)>1000"} >} location_id)

I can use the same syntax to say how many customers spending more than £1000 are buying each product.

What I don't know how to do is get the count of the total number of customers spending more than £1000 and use it to divide the number of customers spending more than £1000 on each product by?

Do I need to use a variable?

1 Solution

Accepted Solutions
vgutkovsky
Master II
Master II

You just need the word "total" in your denominator, assuming that product is the dimension of your chart.

count({<location_id={"=sum(customer_gross_sales)>1000"} >} location_id)

/

count({<location_id={"=sum(customer_gross_sales)>1000"} >} total location_id)

If you have other dimensions in the chart, then you would need <> brackets after the word total and include all dimensions in there except for Product. For example, total <Country,Date>

Regards,

Vlad

View solution in original post

2 Replies
vgutkovsky
Master II
Master II

You just need the word "total" in your denominator, assuming that product is the dimension of your chart.

count({<location_id={"=sum(customer_gross_sales)>1000"} >} location_id)

/

count({<location_id={"=sum(customer_gross_sales)>1000"} >} total location_id)

If you have other dimensions in the chart, then you would need <> brackets after the word total and include all dimensions in there except for Product. For example, total <Country,Date>

Regards,

Vlad

Anonymous
Not applicable
Author

Thanks Vlad. That's exactly what I needed to do. I want to evolve this to be able to show the product penetration over time but that can wait until another iteration.

Thanks very much for your help