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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

beginning and end of the last calendar month

Is there Dax formula that I could use to get the first and last date of the last calendar month?

 

for example

for Today, I would like to return 1 Sept 2020 and 30 Sept 2020

for 29 Feb 2020, I would like to return 1 Jan 2020 and 31 Jan 2020 etc

2 REPLIES 2
AnkitKukreja
Super User
Super User

Hi @Anonymous 

 

You can create this very easily in query editor as well. Just click on your date column and on the ribbon above go to add column, there on the right side select date --> month -->End of the month or start of the month and 2 new columns are added into your data set just with few clicks.

 

Thanks,
Ankit Kukreja

LinkedIn 

If my response has successfully addressed your question or concern, I kindly request that you mark this post as resolved. Additionally, if you found my assistance helpful, a thumbs-up would be greatly appreciated.
Thanks,
Ankit Kukreja
www.linkedin.com/in/ankit-kukreja1904
OwenAuger
Super User
Super User

Hi @Anonymous 

If you want to return these as scalar values, you can use EOMONTH:

First Date of Last Month = 
EOMONTH ( TODAY(), -2 ) + 1

Last Date of Last Month = 
EOMONTH ( TODAY(), -1 )

 

As a side note (possibly not relevant to your situation), if you have a Date table and want to return a range of dates spanning the previous month (relative to today), you can use the PREVIOUSMONTH function:

PREVIOUSMONTH ( TREATAS ( { TODAY () }, 'Date'[Date] ) )

 

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

Top Kudoed Authors