Previous 4 weeks averages

I have used the following script to return each weekly average for a measure:

However, I am struggling trying to return only the last 4 weekly averages.

I have tried using the range operator and LAG(4) : NULL but I have had no luck. I need to create a named set or calculated member which defines the last 4 week range and then use in my script.


  • Edited by DarrenOD Friday, January 30, 2015 3:12 PM
January 30th, 2015 6:11pm

I was able to get it work using the LastPeriods function:

However, I hard coded the date for testing. How do I get the current week member for dynamic script?


  • Edited by DarrenOD Friday, January 30, 2015 3:22 PM
Free Windows Admin Tool Kit Click here and download it now
January 30th, 2015 6:21pm

Thanks Simon,

I have updated my script to return the current week:

However, I need to be able to retrieve the previous 6 weeks from the current week. I therefore need to return a member from the set:

UNION([Today], [FirstOfWeek])

If I get the member value from this set I can use this in the LastPeriods function. I have tested this by hardcoding the current week and this works (see commented out line above).

February 2nd, 2015 6:02am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics