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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

Beginners M: How to Rename JSON Column and Format Date?

Hi All,
 
I'm new to the community and having some trouble with the syntax around pulling data within the M language.  I was hoping someone here may be able to assist.  I have a line of code that reads as follows:

 

DetailColumns = Table.ExpandRecordColumn(RecordsOfPage, "PageData",  {"Field1","Field2","Field3"}​

 

This pulls the 3 fields as expected.  However, I'm trying to understand how I would rename them, preferrable with a space (i.e. "Field1" shows as column "My Name").  And seperately, the data pulled out of one column is formatted as such: 2019-11-27T00:00:00.000.  I believe this is coming across as text.  I would like to ensure it is a proper date field and shorten it to MM/DD/YYYY.
 
If you could offer help with either topic it would be much appreciated!
 
Thank you so much.
-Brett
1 ACCEPTED SOLUTION
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

  • To rename just double click the column name and type in a new one.
  • To change the data type, click on the icon left to the column name and format it as date-time first, and later to date ( make sure you add the step not replace ) the date format should reflect your local settings MM/DD/YYYY should be as default if your windows setting are aligned.

image.png

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn


 

View solution in original post

2 REPLIES 2
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

  • To rename just double click the column name and type in a new one.
  • To change the data type, click on the icon left to the column name and format it as date-time first, and later to date ( make sure you add the step not replace ) the date format should reflect your local settings MM/DD/YYYY should be as default if your windows setting are aligned.

image.png

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn


 

Anonymous
Not applicable

 

Thanks  @Mariusz for the tips.
 
I was looking for a way to do this in code and learned after your post that I could view the code being executed by your suggestion in Advance Editor.  That's awesome.  

 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.