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
Solved! Go to Solution.
Simplest and easiest way to find out the First period of the Timescale is
OFFSET(1,-1,0) = 0
Hope that helps
Sure!!
First let's try to understand what OFFSET does? It basically Pulls or Pushes the numbers across the timescale. There are three parameters that are needed in the Syntax
OFFSET(x,n,z) where x is the source line item to offset
n is the offset value
z is fill value if the result is outside the timescale
Result matches the data format of x - meaning it can be number, boolean or anything else.
FORMULA: OFFSET(1,-1,0) = 0
If you take a look at the left hand side of the formula OFFSET(1,-1,0) it basically throws an output of 1 in all the time periods except the first time period. That is because you are hard coding your first parameter to 1 and then you are asking Anaplan to Push it further by 1 period in the second parameter. Hence the first parameter which is 1 gets pushed to subsequent periods.
If you look at the overall formula now OFFSET(1,-1,0) = 0 it checks the condition and looks for a time period which has 0 in it and matches with that time period.
Now Let's take a look at Second parameter. Here the ask was to find out the first period of the timescale hence second parameter was kept -1. If the ask is to find out first 3 periods of the timescale you can change the second parameter from -1 to -3 ( Its minus because we have to push the values to subsequent periods)
Note: First Parameter doesn't necessarily has to be 1, it can be any number apart from 0
Hope that clarifies it
Simplest and easiest way to find out the First period of the Timescale is
OFFSET(1,-1,0) = 0
Hope that helps
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
Sure!!
First let's try to understand what OFFSET does? It basically Pulls or Pushes the numbers across the timescale. There are three parameters that are needed in the Syntax
OFFSET(x,n,z) where x is the source line item to offset
n is the offset value
z is fill value if the result is outside the timescale
Result matches the data format of x - meaning it can be number, boolean or anything else.
FORMULA: OFFSET(1,-1,0) = 0
If you take a look at the left hand side of the formula OFFSET(1,-1,0) it basically throws an output of 1 in all the time periods except the first time period. That is because you are hard coding your first parameter to 1 and then you are asking Anaplan to Push it further by 1 period in the second parameter. Hence the first parameter which is 1 gets pushed to subsequent periods.
If you look at the overall formula now OFFSET(1,-1,0) = 0 it checks the condition and looks for a time period which has 0 in it and matches with that time period.
Now Let's take a look at Second parameter. Here the ask was to find out the first period of the timescale hence second parameter was kept -1. If the ask is to find out first 3 periods of the timescale you can change the second parameter from -1 to -3 ( Its minus because we have to push the values to subsequent periods)
Note: First Parameter doesn't necessarily has to be 1, it can be any number apart from 0
Hope that clarifies it
Tanks a lot @Misbah , that is extremely helpful !
Hey @Younes
Here is how I translate "my command" OFFSET(1,-1,0)
"Please Mrs. Engine - Yes the Anaplan engine is a she- offset or move the number 1, by 1 prior position (-1) from each period you calculate, and when you can't go back any further let me know by returning a 0"
Since what we need is to determine 1st week (or not), a function like OFFSET is useful because it is bound by the model timescale. It acts in a certain way within the timescale and acts differently otherwise (in this case returns 0). We use this behavior to capture the time period when the formula acts differently - the 1st period.
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.