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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Niraj_vora0106
Helper III
Helper III

Date Format in M-Query

Hi community,

 

I've a doubt regarding Date Formatting in M-Query.

 

I'm trying to learn and execute Date formatting in M-Query using below M-Query code:

Table.TransformColumns(Source, {{"DateColumn", each DateTime.ToText(_, "yyyy-MM-dd"), type text}})

 

Niraj_vora0106_0-1703073811421.png

 

I'm doing the transforming in Calendar Date Master Table.

I've Date and Year column and based on the Date column I'm trying to Create a Custom column  named (Custom Date Format) using M-Query.

 

Below is the error snip:

Niraj_vora0106_1-1703073947545.png

 

Please help!

 

1 ACCEPTED SOLUTION
tackytechtom
Most Valuable Professional
Most Valuable Professional

Hi @Niraj_vora0106 ,

 

How about this:

tackytechtom_0-1703075129383.png

 

You could, however, also change the date format in Power BI:

tackytechtom_1-1703075221341.png

 

Thereby, you wouldn't need to create a new column in Power Query.

 

Hope this helps 🙂

 

/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

2 REPLIES 2
tackytechtom
Most Valuable Professional
Most Valuable Professional

Hi @Niraj_vora0106 ,

 

How about this:

tackytechtom_0-1703075129383.png

 

You could, however, also change the date format in Power BI:

tackytechtom_1-1703075221341.png

 

Thereby, you wouldn't need to create a new column in Power Query.

 

Hope this helps 🙂

 

/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 

Greg_Deckler
Community Champion
Community Champion

@Niraj_vora0106 Try:

#"Added Custom Column" = = Table.AddColumn(#"Changed Type", "Custom Date Format", each DateTime.ToText([Date], "yyyy-MM-dd"))



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.