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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors