OFFSET vs LAG vs LEAD in Anaplan
All three read a value from another period. A positive number looks forward in OFFSET and LEAD, and back in LAG. LAG and LEAD can also block zero or negative offsets. For one period, use PREVIOUS or NEXT.
By Nikolai Starostin, Anaplan architect at MaxPlan and Master Anaplanner. Updated .
What is the difference between OFFSET, LAG and LEAD?
| OFFSET | LAG | LEAD | |
|---|---|---|---|
| Positive amount reads | A later period | An earlier period | A later period |
| Negative amount reads | An earlier period | A later period, unless blocked | An earlier period, unless blocked |
| Outside the timeline | Substitute value | Substitute value | Substitute value |
| Over a list | Polaris only | Polaris only | Polaris only |
OFFSET is the same as LEAD in its default mode.
OFFSET, LAG and LEAD examples
Two months ago, one month ahead, and one month ago:
| Jan | Feb | Mar | Apr | |
|---|---|---|---|---|
| Quantity | 10 | 20 | 30 | 40 |
| LAG by 2 | 0 | 0 | 10 | 20 |
| LEAD by 1 | 20 | 30 | 40 | 0 |
| OFFSET by -1 | 0 | 10 | 20 | 30 |
For exactly one period, PREVIOUS and NEXT are shorter. For last year's total to date, see prior-year YTD.
What do STRICT, SEMISTRICT and NONSTRICT do?
They decide what LAG and LEAD return when the amount is zero or negative.
| Keyword | Positive | Zero | Negative |
|---|---|---|---|
NONSTRICT (default) | Value | Value | Value |
SEMISTRICT | Value | Value | Substitute |
STRICT | Value | Substitute | Substitute |
Use it when the amount is data, so a wrong negative lead time can't read the future:
When should you use POST instead?
LAG reads one value. POST sends values to other periods and adds up those that land together. If the lead time changes by month, two months' orders can arrive in the same month, and only POST adds both:
Planual 2.02-13 says to use POST only when more than one value can apply, because OFFSET, LAG and MOVINGSUM cost much less to calculate.
What changes between Classic and Polaris?
Classic works over Time only. For LAG and LEAD, it cuts a decimal amount toward zero and Polaris rounds it: 1.7 is 1 in Classic and 2 in Polaris. A NaN amount counts as 0 in Classic and gives the substitute value in Polaris. In Classic, LAG and LEAD on anything but a number need a constant amount.
A relative function is also safer than naming a month. Check your own model for hard-coded time periods.
Sources
Check your model
Upload the line-items blueprint. The basic check runs in your browser and needs no email.