Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
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]))
Solved! Go to Solution.
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
_result
Please 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 ,
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
_result
Please 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!
Sorry, it's not working.
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!
I am getting same as current month output.
My dax : Previous Month = CALCULATE(SUM(Table[Value]),DATEADD('CALENDAR'[Date],-1,MONTH))
hi @Srikantht
Try his measure
If my posy helps please give kudos and accept it as a solution!
Thanks.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
82 | |
78 | |
52 | |
39 | |
35 |
User | Count |
---|---|
94 | |
79 | |
51 | |
47 | |
47 |