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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
JoaoMS
Helper III
Helper III

Sort Colum in Power Query with Month Text

Dear all, I have a table with two columns which shows the exchange rate of two currencies per month. The raw data is like this (spanish):

 

MonthYearER
Ene193.332
Feb193.304
Mar193.320
Abr193.309
May193.376
Jun193.290
Jul193.310
Ago193.398
Sep193.350
Oct193.400
Nov193.314
Dic193.378
Ene203.460
Feb203.384

 

However when I upload it in Power Query the table becomes like this, sort by text and I don't know how to sort it back in PowerQuery:

 

MonthYearER
Ene193.332
Abr193.309
Ago193.398
Dic193.378
Ene203.460
Feb193.304
Feb203.384
Jul193.310
Jun193.290
Mar193.320
May193.376
Nov193.314
Oct193.400
Sep193.350

 

The database is in the following link https://estadisticas.bcrp.gob.pe/estadisticas/series/mensuales/resultados/PN01215PM/html

 

Thanks in advance,

Joao

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@JoaoMS 

You would need to replace the Spanish to English first, because the Power Bi cannot read and sort month from different languages.

replace month.JPGdate type.JPG

After all the values are displayed in "19-Jan","19-Feb". You can just change the Data Type from text to date, then sort.

 

Paul Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

@JoaoMS 

You would need to replace the Spanish to English first, because the Power Bi cannot read and sort month from different languages.

replace month.JPGdate type.JPG

After all the values are displayed in "19-Jan","19-Feb". You can just change the Data Type from text to date, then sort.

 

Paul Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Vvelarde
Community Champion
Community Champion

Hi, you need to create an Custom Column with a format date of your string:

 

Example: "1-" & Text.Start([Fecha],3) & "-" & Text.End([Fecha],2)

 

After that Parse in Date Menu. 

 

Its possible that fail with Months in Spanish so replace before parse: Example: 1-Ene-96  to 1-Jan-96

Finally Sort by this new column

 

Regards

 

Victor 




Lima - Peru
amitchandak
Super User
Super User

You need to create sort column and mark it as the sort column for the month year

 

Month year sort = format([Date],"YYYYMM")

Sort_by_column.pngSortnewribbion.png

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

Thank you for the quick response, but it seems that is DAX, is it possible to do the same in Power Query?

 

Regards.

@JoaoMS 

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

example

Date.ToText(#date(2010, 12, 31), "yyyyMM")

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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