Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
This seems like such a simple thing yet i cant get my head around it.. I am trying to work out, in a chart the amount of times a customer has come back into a store per month.. I'm struggling with the expression.. If i use a Count of CustomerID all i get are the total amount of customers that came in per month (obviously).. I wish that there was an Aggregation called Frequency, would make things easier.. Please could someone suggest an easy way of doing this..
I think this:
avg(aggr(count(CustomerID),Month,CustomerID))
The aggr(...,Month,Customer) says that we want to group by Month and CustomerID. For each group, we want to count the number of occurrences of the customer that month, which is to say how many times the customer has visited the shop. The avg() then says take the average of all of those. Normally, that would simply be the average monthly frequency, not the average frequency for each month. But since month is your dimension, I THINK it should give you the average frequency per month. If it doesn't work, let me know. I suspect the answer is that or some simple variation on the theme.
Thanks so much John, worked perfectly, exactly what i was looking for...
John,
This suggestion works nicely, thank you, as you can see in the attached Frequency of orders for Data Center.qvw.
There is one issue, however, not relating to the script.
The Customer, Data Center, has 3 orders. One order, DDV9828, skews the average. For each of its (4) Products ordered, there is a corresponding canceled Product order. As a result, the script averages 8 orders, when we might want to say there is no order.
Do you have any suggestions for addressing this issue?
Oliver