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

How to Correct Different Format Dates in a Column via POWER QUERY?

How to Correct Different Format Dates in a Column via POWER QUERY?

 

dates issue.PNG

 

Data

DatesCorrection

6/1/20236/1/2023
6/2/20236/2/2023
6/3/20236/3/2023
6/4/20236/4/2023
6.5.20236/5/2023
6.6.20236/6/2023
6.7.20236/7/2023
2023-27-66/27/2023
27-6-20236/27/2023
310520225/31/2022
6..20…20236/20/2023
1 REPLY 1
collinsg
Super User
Super User

Good day @RahimZulfiqar87 ,

Loading the dates into Power Query and setting the column type as "Date" will make a best effort guess at the format but is not guaranteed. For example text of 6/12/2023 (d/M/yyyy) and text of 12/6/2023 (M/d/yyyy) are the same date but Power Query will convert them using its Culture (or Culture you specifiy) and so convert them to different dates.

 

For robust conversion you need to tell Power Query the format it is ingesting and the locale you want translated to. Provided you do this you will be successful converting any of your formats. For example, if you load your dates you can use Date.FromText. It has optional parameters where you specify the format being ingested and the culture to convert to, e.g. with a column of "type" ABC123 called "Dates",

Date.FromText( [Dates], [Format="M..d...yyyy",Culture="en-US"] )
or
Date.FromText( [Dates], [Format="d-M-yyyy",Culture="en-US"])

For the case of 31052022 Power Query will see it as a number so you could

Date.FromText( Text.From([Dates]), [Format="dMMyyyy",Culture="en-US"])

Date.FromText is described here and the format codes are described here.

Hope this helps

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

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

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.