2 Replies Latest reply: Jun 26, 2014 11:59 AM by Peter Thornton

# 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?

• ###### Re: Using set analysis to generate a percentage

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,