I have a problem with my data. I know this should be fairly easy to solve with previous or peek functions, but I am not very familiar with them and can't make this work.
I have following problem in my data
I have a inventory data in where I have moving average valuation (in this example above "valuation"). However, I am missing this moving average value in every case in where I have no movements in the period. If there is no value, I would need to use the previous existing one. So in this case valuation in period 3 should be 1,2 and same thing in period 4 and 5. In period 7 I would need to use the value from period 6.
However, I found out that script doesn't work always. It is saying now that if value is missing or zerrow it peak the last one. However it is possible that sometimes value is 0 and then script should return that one. So how to modify the script so that it peaks the last one only in case that it is totallu missing?
Value in original data
In the example above I have accumulation key which contains location and product id. I have used that to group the data.