Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
vishu263
Helper II
Helper II

Need to get previous month date by creating a DAX measure.

@PBI_Member_01 

I want to see the previous month date against the existing date column in my dataset.

For e.g. If column DOJ shows the date 15/09/22, the measure should show 15/08/22.

We can achieve this output in Calculated Column by writing following DAX 

=Dateadd(DOJ,-1,MONTH)

However I am not sure how can we achieve the same result by writing a measure.

1 ACCEPTED SOLUTION
tackytechtom
Super User
Super User

Hi @vishu263 ,

 

If you really wanna use a measure, you can try this one:

DateMeasure = 
VAR _year = YEAR ( SELECTEDVALUE ( TablePivot[Date] ) )
VAR _month = MONTH ( SELECTEDVALUE ( TablePivot[Date] ) )
VAR _day = DAY ( SELECTEDVALUE ( TablePivot[Date] ) )
RETURN
IFERROR ( DATE ( _year, _month - 1, _day), EOMONTH ( DATE ( _year, _month, 1 ), 0 ) )

tackytechtom_0-1684725657850.png

 

Does this work?

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

View solution in original post

3 REPLIES 3
tackytechtom
Super User
Super User

Hi @vishu263 ,

 

If you really wanna use a measure, you can try this one:

DateMeasure = 
VAR _year = YEAR ( SELECTEDVALUE ( TablePivot[Date] ) )
VAR _month = MONTH ( SELECTEDVALUE ( TablePivot[Date] ) )
VAR _day = DAY ( SELECTEDVALUE ( TablePivot[Date] ) )
RETURN
IFERROR ( DATE ( _year, _month - 1, _day), EOMONTH ( DATE ( _year, _month, 1 ), 0 ) )

tackytechtom_0-1684725657850.png

 

Does this work?

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

Yes, It does. Thanks a lot for quick solution 🙂

tackytechtom
Super User
Super User

Hi @vishu263 ,

 

My tip here is to use a date dimension and precalculate this "samedaypreviousmonth" attribute already in the dimension instead of creating a separate measure.

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.