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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount 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
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors
Top Kudoed Authors