Forum Discussion
Rolling Sum Not Working when Empty Data
Hello! I have used this formula in dozens of examples but for whatever reason it is not working for this example.
I will try to explain this as best possible. I have a data source that I receive that has a date column called "Last Seen On". This is a count of inventory table, so if a product was last in stock on December 10th, thats the date that that will be in "Last Seen On".
From there, I connected that date to a date table so that i can quickly filter by month, quarter, year, etc.
So here is my dilemma. I want to measure the rolling 2 months inventory of a SKU. So using the above example, a product was last seen in inventory on December 10th. If i use January 2023 as my filter, then i should see the inventory of December 2022 and January 2023. Example below.
The measure i am using (and have used dozens of time before) is ;
8 Replies
- dswindenHelper II
Hi Greg_Deckler , thanks for sharing but i am looking for the total sales during that time, not just the average. Would your variable still work for that?
- Greg_DecklerCommunity Champion
dswinden Sure, just use SUMX instead of AVERAGEX, regardless the rolling part is the same.
- PadycosmosSolution Sage
Hope this video helps:
- dswindenHelper II
Thank you, but the same outcome as previous two methods. My best guess is that there is either a problem with my date hierarchy, or that it is having a challenge handling data with no records (There is no January records of this dataset, so when i select january for R2M, it shows null)
- PadycosmosSolution Sage
In your case, the total is calculated based only on the current value and the immediately preceding value.So in Feb 22, it is adding The value of Feb 22 and Jan 22, which are both 0 and therefore you get 0 as the result