Forum Discussion
Previous Month Calculation getting Wrong
Hi All,
I am trying to get previous month values by using the below dax but getting wrong values. Can any one help in this to get the expected output. Thanks in Advance.
Dax :
Previous Month = CALCULATE(SUM(value),
ALL(Table),
PREVIOUSMONTH(Table[Date]))
- Anonymous2 years ago
Hi Srikantht ,
Please try create a measure with below dax formula, but you need adjust it according to your actua calculate context:
Previous month = VAR cur_date = SELECTEDVALUE ( 'Table'[Date] ) VAR _result = CALCULATE ( MAX ( [Current Month] ), FILTER ( ALL ( 'Table' ), DATEDIFF ( cur_date, [Date], MONTH ) = -1 ) ) RETURN _resultPlease refer the attached .pbix file.
Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
6 Replies
- AnonymousNot applicable
Hi Srikantht ,
Please try create a measure with below dax formula, but you need adjust it according to your actua calculate context:
Previous month = VAR cur_date = SELECTEDVALUE ( 'Table'[Date] ) VAR _result = CALCULATE ( MAX ( [Current Month] ), FILTER ( ALL ( 'Table' ), DATEDIFF ( cur_date, [Date], MONTH ) = -1 ) ) RETURN _resultPlease refer the attached .pbix file.
Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.