Forum Discussion

cham's avatar
cham
Icon for Post Patron rankPost Patron
5 years ago
Solved

Previous Month to Date

Hi I have a issue with Matrix table sub total,

 

I have craeted below measures

Amount Sales = SUM(Sales[Amount])
Prev Month To Date = IF([MTH]=1, 0, CALCULATE ([Amount Sales], DATEADD(Calender[Date],-1, MONTH)))
Sales Amount Mth = [Amount Sales] - [Prev Month To Date]
 
When I added the Sales Smount Mth to Matrix table its giving the each month value correctly. But total SUM for each Year is wrong.
 
Can someone help.
 
Thank you.
  • cham Try:

    Measure Total =
      VAR __Total = SUMX(SUMMARIZE('Table',[End of Month],"__PrevMonth",[PreviousMonthMeasure]),[__PrevMonth])
    RETURN
      IF(HASONEVALUE('Table'[End of Month]),[PreviousMonthMeasure],__Total)

12 Replies