Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Last week I asked a question where I wanted to count customers spending more than £500 who were buying specific products. Someone gave me the answer to that particular question with this bit of code: count({<location_id={"=Sum(customer_gross_sales)>500"}>}location_id)
I then want to be able to say what percentage of customers spending more than £500 are buying each product. My question is how to count all of the customers and not just those related to the particular product? Could I establish a variable to count them and then use this?
count({<location_id={"=Sum(customer_gross_sales)>500"}>}location_id) / count({1}location_id)
count({<location_id={"=Sum(customer_gross_sales)>500"}>}location_id) / count({1}location_id)
Hi Peter,
It seems you would like to count how many customers who has having sales more than 500 for each Location, You can achieve using this Sum(Aggr(IF(count({<location_id={"=Sum(customer_gross_sales)>500"}>}location_id))>1,1),[location_id]))';
Regards,
Chinni Kanna
Each customer has a distinct location_ID so customer and location_ID are synonymous.
Hi Anbu,
thanks for your reply. What does {1} do when put in front of location_ID?
Thanks,
Peter
In set analysis, 1 Represents the full set of all the records in the application
Count({1} location_ID) gives the count of all customers in your application
Thanks. I'm pretty sure that's the answer then. Thanks for your help.
try this then
Sum(Aggr(IF(Sum(customer_gross_sales)>500,1),[Cust ID]))
Regards,
Chinni Kanna
That didn't actually seem to work as it gave a different number for each product when the number of customers spending more than £500 is the same for each product (although they don't buy all products).
Hi Peter,
Please send us sample data
Thanks & Regards,
Chinni Kanna