Move yearly data by 6 months
Sometimes it can be necessary to shift data in a yearly model by half a year. While not very intuitive, it can be achieved quite easily.
Consider the following data:
Year | Value |
---|---|
2018 | 0 |
2019 | 10 |
2020 | 0 |
Say, we want to move the value in 2019 by 6 months, to account, for example for a procurement in the middle of the year.
We first bring X to a monthly level with the help of EXPAND
Y = 'X' * EXPAND(1/12,"Month") =
Month | Value |
---|---|
2018-.. | 0 |
2018-12 | 0 |
2019-01 | 10 * 1/12 |
2019-02 | 10 * 1/12 |
2019-.. | 10 * 1/12 |
2019-12 | 10 * 1/12 |
2020-01 | 0 |
2020-.. | 0 |
We can now move the data in the future
Z = SHIFT('Y',"Month",-6) =
Month | Value |
---|---|
2019-.. | 0 |
2019-06 | 0 |
2019-07 | 10 * 1/12 |
2019-08 | 10 * 1/12 |
2019-.. | 10 * 1/12 |
2020-06 | 10 * 1/12 |
2020-07 | 0 |
2020-.. | 0 |
With DROPLEVEL('Z',"Year","SUM") we can bring the data back to the year level.
Year | Value |
---|---|
2018 | 0 |
2019 | 5 |
2020 | 5 |
Starting with Version 2.14 you can also enter the -6 in a simulatable node. See SHIFT.