Forum

Change date format ...
 
Notifications
Clear all

Change date format to "mmm-yy"

6 Posts
2 Users
0 Reactions
87 Views
(@dani104)
Posts: 50
Trusted Member
Topic starter
 

Hello,

Could you please advise the M Language formula to convert date format from "dd/mm/yyyy" to "mmm-yy"?  I have tried a few formula (for example FORMAT([Request Date],"mmm-yy" and variations of this), but it errors.

 

Thanks so much.

 
Posted : 09/02/2021 1:03 am
Philip Treacy
(@philipt)
Posts: 1630
Member Admin
 

Hi Danielle,

That's a formatting/display problem that you would do either directly in excel or in DAX, not in Power Query.

Your attached Excel file states that you want a column to show e.g. Jan-21.  You can do that without bringing the data into Power Query.  

Select the date cells and then press CTRL+1 to show the Format Cells dialog box.

On the Number tab click the Custom category and then scroll down to mmm-yy and select it, or type mmm-yy into the Format area - see attached image.

Regards

Phil

form-box.png

 
Posted : 09/02/2021 1:31 am
(@dani104)
Posts: 50
Trusted Member
Topic starter
 

Thanks, Philip.

 
Posted : 09/02/2021 2:02 am
(@dani104)
Posts: 50
Trusted Member
Topic starter
 

I assume it would be the same case for postcode formats?  That is, for NT, postcodes have a leading zero, which is cut off, when loaded to Power Query.  So the only way around this, is to use Custom Format "0000" in Excel.  Is that correct?

 
Posted : 09/02/2021 8:42 pm
Philip Treacy
(@philipt)
Posts: 1630
Member Admin
 

Hi Danielle,

Correct.  Power Query shows you the data as it actually is, without leading zeroes. In Excel or DAX you can apply formatting to affect how that data is displayed.

Regards

Phil

 
Posted : 09/02/2021 9:28 pm
(@dani104)
Posts: 50
Trusted Member
Topic starter
 

Thank-you, Philip.

 
Posted : 09/02/2021 10:19 pm
Share: