Average frequency between events

paivers

Board Regular
Joined
Sep 4, 2009
Messages
64
I have a simple table of customer IDs and event dates. I want to measure the average days between events for each customer, and average them for specific groups. I have a date dimension. I get the feeling I need to calculate with an all filter. I would take all events within the selected time range and find the min/max (since you cannot assume a frequency outside of that), count up the events in that range and divide the days in the range by the number of events minus one - e.g. 3 events, take the days between the first and last / 2. The problem I am running into is that if I take all events in the range, it will be for all customers, and so very high frequency. I need to force it to calculate for each customer first, then aggregate. Has anyone done anything like this or have any ideas.
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
I have a simple table of customer IDs and event dates. I want to measure the average days between events for each customer, and average them for specific groups. I have a date dimension. I get the feeling I need to calculate with an all filter. I would take all events within the selected time range and find the min/max (since you cannot assume a frequency outside of that), count up the events in that range and divide the days in the range by the number of events minus one - e.g. 3 events, take the days between the first and last / 2. The problem I am running into is that if I take all events in the range, it will be for all customers, and so very high frequency. I need to force it to calculate for each customer first, then aggregate. Has anyone done anything like this or have any ideas.

Hi Paivers,
Do you really want just to divide the first and the last date by the number of events?
I am not sure if I understood correctly but I could imagine the following solution:
I would have the customer id on my pivot-table and the date-filter (e.g. a certain month) as a slicer.
In order to calculate the number of events per customer:
NoOfEvents:=calculate(countx(events;events[customer id]))
And to calculate the distance between the first and the last event according to the current filter:
Distance:=calculate(
IF([NoOfEvents]=0;blank();
countx(
DATESBETWEEN(Datum[Date];FIRSTDATE(events[event date]);lastdate(events[event date]));
Datum[date])))
The relevant measure would just be the division
Average Frequency:=DIVIDE([Distance];[NoOfEvents])
I hope I understood correctly. Regards julianwi
 
Upvote 0
Yes, that looks about right, the DATESBETWEEN() was what I was missing. I do think I would divide the days between first and last by the number of events-1 to get the average gap, so if 3 events (first, middle, last), I divide by 2 to get the first half and last half. Thanks Julianwi, I'll give it a try.
 
Upvote 0

Forum statistics

Threads
1,223,954
Messages
6,175,601
Members
452,658
Latest member
GStorm

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top