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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Reverse date to first day of month in M Language

Hello friends,

 

I have a column looks like this

02/07/2020
05/06/2019
13/12/2015
30/01/2017

 

I want to convert to

01/07/2020
01/06/2019
01/12/2015
01/01/2017

 

I am currently using an ugly way of achieve

1. Convert date to text,

2. Trim the first two digit,

3. Concat with "01"

4. Convert it back to date.

 

Just want to know is there an elegant way?

2 ACCEPTED SOLUTIONS
GilbertQ
Super User
Super User

Hi there

If you create a new Custom Column you can put in the following

Date.StartOfMonth([Column Name])




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

View solution in original post

AllisonKennedy
Super User
Super User

@Anonymous  There is also a button for this in the Add Column tab in Power Query: 

start of month.png


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

This calculated formula in DAX will also work

=EOMONTH(Data[Date],-1)+1


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
AllisonKennedy
Super User
Super User

@Anonymous  There is also a button for this in the Add Column tab in Power Query: 

start of month.png


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

GilbertQ
Super User
Super User

Hi there

If you create a new Custom Column you can put in the following

Date.StartOfMonth([Column Name])




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.