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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
CharlieVan
New Member

Converting dates from MM/DD/YYYY to DD/MM/YYYY in Power Query

I have a column that contains dates in the format of MM/DD/YYYY (seel below picture)

I need to convert this date format to DD/MM/YYYY.

Please note the column in which the dates are stored has a mixed data type ... some dates are in "Text" and others "Whole Number". Whe i try to conver the column to a "Date" format some values are converted and others "Error".

CharlieVan_0-1679968359833.png

 

4 REPLIES 4
Ahmedx
Super User
Super User

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
https://1drv.ms/u/s!AiUZ0Ws7G26RhmQq2FbhI0XPLIeS?e=rmicvd

 

try DateTime.FromText(
    Text.Split( [date], " " ){0} &" "&Text.Split( [date], " " ){1},[Format = "MM/dd/yyyy h:mm:ss"]) otherwise
    try DateTime.FromText(
    Text.Split( [date], " " ){0} &" "&Text.Split( [date], " " ){1},[Format = "M/dd/yyyy h:mm:ss"]) otherwise
   DateTime.FromText(
    Text.Split( [date], " " ){0} &" "&Text.Split( [date], " " ){1},[Format = "MM/dd/yyyy h:mm"])
-------- 
OR
--------
try DateTime.FromText(
    Text.Split( Text.From( [date]), " " ){0} &" "&Text.Split( Text.From( [date]), " " ){1},[Format = "MM/dd/yyyy h:mm:ss"]) otherwise
    try DateTime.FromText(
    Text.Split( Text.From( [date]), " " ){0} &" "&Text.Split( Text.From( [date]), " " ){1},[Format = "M/dd/yyyy h:mm:ss"]) otherwise
   DateTime.FromText(
    Text.Split( Text.From( [date]), " " ){0} &" "&Text.Split( Text.From( [date]), " " ){1},[Format = "MM/dd/yyyy h:mm"])

 

 

Screen Capture #759.png

Ahmedx
Super User
Super User

could you share your pbix-file? Or create an example file which reproduces your issue?

amitchandak
Super User
Super User

@CharlieVan ,  You have to based on each row

These functions will help

Power Query - Text.Start, Text.Middle, Text.End: https://www.youtube.com/watch?v=vky4wPqm0O0

Text.Length: https://youtu.be/DsHgFzNyTdM

 

and Number.IsNaN

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi @amitchandak ,

Thanks for the infomration.

I managed to use the "Text.Start, Text.Middle, Text.End" function in power query and the column was created as required (see below).

CharlieVan_0-1679972766469.png

However when i added the Date.FromText to the custom column query i get a number of errors - see below:

CharlieVan_1-1679972828138.png

 

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.

Top Solution Authors