Forum Discussion

dswinden's avatar
dswinden
Helper II
3 years ago

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 ;

 
CALCULATE(sum('Distribution Listings'[Current stock]),DATESINPERIOD('Date XREF'[Month Start],LASTDATE('Date XREF'[Month Start]),-2,MONTH))
 
BUT the result i get when i use this measure is below.  Because there is only two records for this item, and they occured in November and December, i only see the R2M results of Nov/Dec.  I SHOULD see January 2023 showing 9 in current stock and then Feb 2023 showing 0 (as it does with the "Expected Result" column above

 

 

 

8 Replies