There have been a few instances where we need to take the fist value of a metric and have it populate earlier periods that are blank and take the last value and populate remaining blank periods.
Lets assume we have a metric called Salary, with a set of values from a limited period (i.e., Mar - Jun):
Jan | Feb | Mar | Apr | May | Jun | Jul | Aug |
---|---|---|---|---|---|---|---|
5000 | 5000 | 5250 | 5250 |
Below is the final result we need :
Jan | Feb | Mar | Apr | May | Jun | Jul | Aug |
---|---|---|---|---|---|---|---|
5000 | 5000 | 5000 | 5000 | 5250 | 5250 | 5250 | 5250 |
I’ve seen the use of the previous function to populate the earlier periods:
if(isnotblank(Salary), Salary, previous(Month on -rank(Month.’Start Date’))
and a slightly adjusted formula to populate the later periods (i.e., take out the - in front of the rank function):
if(isnotblank(Salary), Salary, previous(Month on rank(Month.’Start Date’))
I’ve been unable to find documentation on how the previous function uses the on parameter.
Is there another way to accomplish this or can someone share how the on parameter in the previous function works?