How to retain accurate measure values when using Lag or Fsum with monthly aggregation?
Summary:
When using the Lag function to retrieve past measure values, it cannot retrieve the correct value if the past data is displayed on a monthly basis.
For example:
Custom PAB = Nvl(Lag(Custom PAB, 1), 0) Nvl(On Hand, 0) Nvl(Planned Order, 0)- Nvl(Net Forecast, 0)-Nvl(Sales Order, 0)....
Assume the Custom PAB on 30-Nov is 971, and the Custom PAB on 1-Dec is 3971 (calculated as 971 + 3000 supplies - 0 demand).
If the data for November and December is displayed daily, the results are shown correctly.
However, when November is collapsed and displayed as monthly data, the Custom PAB on 1-Dec becomes 3000. Is there a way to prevent this issue?