AOB
Well-known Member
- Joined
- Dec 15, 2010
- Messages
- 669
- Office Version
- 365
- 2016
- 2013
- Platform
- Windows
I have a table of data which includes a timestamp column (date/time)
I need a formula to calculate the average number (count) of rows per week but only up-to and including a given date/time (so not the average across the entire dataset, but the average up to a certain point in the dataset)
I have additional calculated columns [Year] and [Week of Year] derived from the timestamp so that I can identify / group distinct weeks together
This formula works to calculate the average number (count) of rows per week across the entire dataset :
To incorporate the cutoff point, I tried this :
But obviously this falls over because the COUNTIFS returns zeros in the array for those records which come after the [Cutoff] date, resulting in the 1/COUNTIFS having division by zero (#DIV/0!)
Any suggestions as to how I can get the average weekly count of records but only focusing on those records up to and including a given date and not the entire dataset?
Thanks!
I need a formula to calculate the average number (count) of rows per week but only up-to and including a given date/time (so not the average across the entire dataset, but the average up to a certain point in the dataset)
I have additional calculated columns [Year] and [Week of Year] derived from the timestamp so that I can identify / group distinct weeks together
This formula works to calculate the average number (count) of rows per week across the entire dataset :
Excel Formula:
=COUNT(MyTable[Timestamp])/SUMPRODUCT(1/COUNTIFS(MyTable[Year],MyTable[Year],MyTable[Week of Year],MyTable[Week of Year]))
To incorporate the cutoff point, I tried this :
Excel Formula:
=COUNTIF(MyTable[Timestamp],"<="&[@[Cutoff]])/SUMPRODUCT(1/COUNTIFS(MyTable[Year],MyTable[Year],MyTable[Week of Year],MyTable[Week of Year],MyTable[Timestamp],"<="&[@[Cutoff]]))
But obviously this falls over because the COUNTIFS returns zeros in the array for those records which come after the [Cutoff] date, resulting in the 1/COUNTIFS having division by zero (#DIV/0!)
Any suggestions as to how I can get the average weekly count of records but only focusing on those records up to and including a given date and not the entire dataset?
Thanks!