Forum Discussion
Month over Month total
Hello all,
I have trouble with the total sum of a Month over Month calculation.
This are my Measures:
MoM =
VAR ValueCurrentPeriod = SUM(TblA[Value])
VAR ValuePreviousPeriod = [Sales PM]
VAR Result =
IF (
NOT ISBLANK ( ValueCurrentPeriod ) && NOT ISBLANK ( ValuePreviousPeriod ),
ValueCurrentPeriod - ValuePreviousPeriod
)
RETURN
Result
Sales PM =
VAR CurrentYearMonthNumber = SELECTEDVALUE ( 'Date'[Year Month Number] )
VAR PreviousYearMonthNumber = CurrentYearMonthNumber - 1
VAR Result =
CALCULATE (
SUM(TblA[Value]),
REMOVEFILTERS ( 'Date' ),
'Date'[Year Month Number] = PreviousYearMonthNumber
)
RETURN
Result
Because the column is missing the sum, the row of totals is not correct. Any suggestions how I could solve this? Help is much appreciated.
- _MoM Sales =VAR _Prev =CALCULATE([Total Sales],PARALLELPERIOD('Date'[Date],-1,MONTH))RETURN[Total Sales] - _Prev
If this post helps, please consider accept as solution to help other members find it more quickly.
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
2 Replies
- Mahesh0016Super User_MoM Sales =VAR _Prev =CALCULATE([Total Sales],PARALLELPERIOD('Date'[Date],-1,MONTH))RETURN[Total Sales] - _Prev
If this post helps, please consider accept as solution to help other members find it more quickly.
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.- HinnaxsenFrequent Visitor
Thank you very much! It works. Learned something again!