Calculate First & Last Week of each month

Original Thread (Credit goes to@JaredDolich )

 

Hi all Anaplanners,

 

Your solution worked great, I just have a question to ask, so when we are trying to find the first and last week # that belongs to each month, it worked really well for the first year, it doesn't work well for the 2nd year because the week # would be greater than 52. For example, if my timeline is from 2019 Jan to 2020 Dec, the start week # for Dec 2019 would be 48 and end week # would be 52. However, for Jan 2020 the starting week is 53 instead of 1. Is there a way to reset the count so it would go back to 1?

 

My solution was to create a new line which sets the Previous Last Week to 0 when it's higher than 52. Please let me know if you have other solutions. 

 

Capture2.PNG

 

Capture1.PNG

Tagged:

Best Answer

  • JaredDolich
    Answer ✓

    @jimfeng5 

    This is what I love about Anaplan, there are many answers.

    Your solution is fine.

    One idea that I thought about was you could add a Boolean to your Time System module (the one with months - i think it's the one you screenshot) and add a check for the first month. then your If statement would be if MonthCheck<>1 then [normal logic] else [start weeks over].

    We use the <> because 11/12 times it will be false and we want the if statement to exit as early as possible.

     

    Anyway, your solution is terrific.