Level 2 Sprint 3 INV01 - Not 1st week of Timescale?

Hello,
I used the "NOT INPERIOD(CURRENTPERIODSTART())"  formula to calculate to determine if it's the first week of the time scale or not and it's working. But i know that if we change the current period my formula doesn't not work anymore. I couldn't find a formula that targets the start of time scale and not the current period. Could you help me ? @einas.ibrahim 

Thank you

Younes

Comments

  • @Younes 

     

    Simplest and easiest way to find out the First period of the Timescale is 

     

    OFFSET(1,-1,0) = 0

     

    Hope that helps

     

     

  • @Misbah 😠

    I was going to help @Younes arrive at that by himself.
    Hey @Younes let us know if you have other questions or need more explanation on this formula 😊

  • @einas.ibrahim 

     

    Apologies.

     

    Usually I don't share the formula esp with Level 3 aspirants but for Level 2 & Level 1 I help them in creating SYS Modules only. 

  • Hello @einas.ibrahim @Misbah 
    Thank you for your help. I'd like to understand more the formula. How does Anaplan know with this formula that we are talking about the Time scale whe writing OFFSET(1,-1,0) ?

    Younes 

  • Tanks a lot @Misbah , that is extremely helpful !

  • Thank you soooo much @Misbah , I had been stuck on this part forever!

  • Hi @Misbah @einas.ibrahim ,

     

    Shouldn't we need to avoid hard coding in the formulas? I mean that's what training teaches us.

    Is that the only way to find out the first week's condition?

    Just trying to understand.

  • @einas.ibrahim @Misbah 

    In the training module, we have created NOT 1st week of time scale? line item in SYS01 tym settings by week module. So why we are trying to find out first week of timescale using OFFSET function?

    IF NOT 1st week of time scale? PREVIOUS (Ending Inventory of previous week) ELSE DAT01 Beginning Inv Module.Beginning Inventory

    Does this formula not serve the purpose?, finding my way for how to get ending inventory line item for the previous week.

  • Hi @kunal_311,

     

    Let me answer your "hard coding" question first. There is no hardcoding in OFFSET(1,-1,0). Generally speaking, hardcoding is when you write a value that will change over time or product,....etc. For Example FY19 or IF Product.Product item = Apples.

    In this OFFSET formula, none of the values will be obsolete or irrelevant regardless or changes in Time. As a matter of fact, this formula will continue to work even when the Time Range changes, For example when we move to the next planning year FY21

     

    Now to your second question, I am not sure what are you asking exactly? The OFFSET formula is the formula we are using in SYS01 to determine the first week (or not the 1st week), We then reference this line item in our Inventory Ending formula in INV01.

  • Hi @einas.ibrahim 

    Apprciate your efforts to make newbies like us to understand the concepts:

     

    1) Understood the hardcoding part.

    2) I mixed it with the formula to be used in INV01 and that with SYS01. Even I used "NOT Current period?" as my formula which after reading your explanation on why we need to use OFFSET Instead of CURRENTPERIOD, It makes more sense. so changed it now.

  • Hey @kunal_311 

     

    I'm always happy to help. 

     

    I hope you realized why CurrentPeriod is not suitable. Current period changes - ideally every period. So while CurrentPeriod may be the same as the first period on the time scale - say on Jan 01, 20XX- once the current period moves to Feb, it is no longer the same as the first period of the time scale.

     

    Keep on Anaplanning

     

     

  • Just one last point i want to understand, when we use offset function & we shift the weeks which are not 1 st week, but after offset why we need to provide =1 ?
    OFFSET(x,n,z) = 1
  • Hey @kunal_311 

     

    On the semantics side .....

    The Not 1st week? is of data type Boolean, right?

    which mean any formula we right in this line item should return a Boolean (True or False)

    The OFFSET(x,y,z) function returns the same format of the argument x

    In the case of OFFSET(1,-1,0), x = 1 which is a number. so just writing OFFSET(1,-1,0) will return a number not a boolean, and will not be accepted.

     

    On the logic side..

    You need to know if the function succeeds in moving the 1 (x), -1 periods (y) and in that case, it returns the value 1, or fails (because it's at the beginning of the time scale and there is no prior period) and in this case, it returns the default value 0(z)

    You need an expression that resolves to either TRUE or FALSE.

    so you compare the returned value of the OFFSET function with either 1 or 0 it's your choice.

    In the case of the first period

    Does OFFSET(1,-1,0) = 1 ? No, this is FALSE, because the formula returns 0

     

     

  • Hi @Misbah @einas.ibrahim 

     

    Thanks a lot for your explanation. What if I would like to find the first week of each year? As I understand, the OFFSET formula only finds the first week of the time range.

     

    Thanks,

    Xin

  • @xin 

     

    See if this helps

    Misbah_0-1598873279779.png

     

    Misbah_1-1598873337560.png

    Below is the filtered view of the output module.

    Misbah_2-1598873430072.png

     

     

     

  • Hey Misbah,

     

    This was a brilliant explanation for the OFFSET function.

     

    However, I don't clearly understand how to enable 'End users to manually select the first week in FY20'. Could you please help me with this ?

     

    Regards 

  • Hi @Misbah,

     

    I am wondering if you can tell me something utterly basic for my sanity check.  When people say "time period" or "time scale", it is the Time Range indicated as per:

    kotoponus_0-1606753223408.png

    The model calendar is as per below.  Ans the timescale is from Current Fiscal Year + Number of Past Year to Current Fiscal Year + Number of Future Year as per below:

    kotoponus_1-1606753291323.png

     

    Starting time for the timescale, in this case, is 29/Dec/2019 as there is no Past Year Number and the Ending time 26/Dec/2021 (Or whatever works out as the last week of the FY21) as the Number of the Future Year is 1. 

     

    Therefore, what you suggest works as it only needs to identify as the only first week of the entire timescale (the 2 FYs) needs to be identified.