I have a dataset which details the hours worked for every employee each week of the year. I want to calculate a moving average over the past 26 weeks. Is this possible? Note, my date table does not have individual dates as the main dataset is in weeks.
How is the week value stored, is it just an integer, and does it reset yearly? Assuming yes and yes, I'd try looking up solutions on how people have created a yearmonth column in a date table - if you can do similar and end up with something like 201652 for the last week of last year and 201701 for the first week of this year, then you've got a single integer where the highest values are the most recent. It should be straightforward to use something like TOPN(26) as a filter for an average on your hours column
Hi Charlie Thanks for your reply. I think this is close to what I need but I need it for each employee and when I add the employee number field the calculations don't look correct. Is there anything else I can do? Thanks Emma