Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Get Previous Running Total for Missing Month

Hi All,   Let say I have two tables like below, I want to make accumulative line graph of which line should always increase. The 'Date' table and 'ShipQty' table has relation in date column. X ax...
  • dax's avatar
    dax
    6 years ago

    Hi Anonymous , 

    You could create a calendat table (2019/1/~2022/12/21)

    calendar = CALENDAR(date(2019,1,1), date(2022,12,31))

    then create relationship between calendar and fact table, and use measure and calendar in table like below, 

    Measure = var  maxd=CALCULATE(MAX('Table'[Date]), ALLEXCEPT('Table','Table'[Item]))  return CALCULATE(SUM('Table'[  Qty]), FILTER(ALLSELECTED('calendar'), 'calendar'[Date]<=MIN('calendar'[Date]) && MIN('calendar'[Date])<=maxd))

     

     It will show all months in each year, and end with the max month in fact table. You could refer to my sample for details.

    Best Regards,
    Zoe Zhi

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.