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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Anonymous
Not applicable

Issue converting date from JSON source

Hi all, 

 

As per the below screenshot, when I import a JSON file into Power BI, there is an issue with the formatting of the date. 

 

When I try and change the column to Date/Time using the 'Date Type' option in the column tools, I get the following erorr - 'We can't automatically convert the column to Date/Time type'. 

 

Please can anyone advise on the best way to achieve the date format of dd/mm/yyyy hh/mm. Any help is greatly appreciated!

 

Date format error converting.PNGIncorrect date format.PNG

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

You can add a custom column with below code in Power Query editor and use it to replace the original column. 

Date.FromText(Text.BeforeDelimiter([Last Start Date]," "))&Time.FromText(Text.AfterDelimiter([Last Start Date]," "))

21102504.jpg

 

Or if you want to transform the original column directly, it would be:

= Table.TransformColumns(#"Changed Type", {{"Last Start Date", each Date.FromText(Text.BeforeDelimiter(_," "))&Time.FromText(Text.AfterDelimiter(_," ")), type datetime}})

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

5 REPLIES 5
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

You can add a custom column with below code in Power Query editor and use it to replace the original column. 

Date.FromText(Text.BeforeDelimiter([Last Start Date]," "))&Time.FromText(Text.AfterDelimiter([Last Start Date]," "))

21102504.jpg

 

Or if you want to transform the original column directly, it would be:

= Table.TransformColumns(#"Changed Type", {{"Last Start Date", each Date.FromText(Text.BeforeDelimiter(_," "))&Time.FromText(Text.AfterDelimiter(_," ")), type datetime}})

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

Anonymous
Not applicable

Hi, thank you for this! The top method works although ideally I would need to transform the original column. I can see the code pasted but how do I transform the column? 

@Anonymous 

 

See the formula bar above the table? You can click on "fx" to add a step and paste the code there. My previous step is "Changed Type", so I have it as the first variable in Table.TransformColumns() function. Replace it with your previous step name and don't forget the "#". You will see its previous step in the formula bar after clicking "fx".

21102601.jpg

 

BR,

Jing

mahoneypat
Microsoft Employee
Microsoft Employee

Here's one way to do it with a custom column.  Or you could adapt this formula into a custom transform column step.

 

= DateTime.From(Date.FromText(Text.BeforeDelimiter([DateTime], " "))) + Duration.FromText(Text.AfterDelimiter([DateTime], " "))

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


amitchandak
Super User
Super User

@Anonymous , In power query try a new column

= Date.FromText([Date])

//Change data type to date

 

https://docs.microsoft.com/en-us/powerquery-m/date-fromtext

 

In column format choose the format you want(Column tools)

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

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.