Forum Discussion
Previous Month Calculation getting Wrong
- 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.
Hi Srikantht
Try below dax:
Prev Month= calculate( sum(value), dateadd(Date,-1,Month))
If my post helps you. please give kudos and accept it as a solution!
- Srikantht2 years agoHelper II
Sorry, it's not working.
- Uzi20192 years agoCommunity Champion
Hi Srikantht
what answer you are getting??
I am getting the correct result through Dateadd function
If my post helps give kudos and accept it as solution!- Srikantht2 years agoHelper II
I am getting same as current month output.
My dax : Previous Month = CALCULATE(SUM(Table[Value]),DATEADD('CALENDAR'[Date],-1,MONTH))