Forum Discussion

JoaoMS's avatar
JoaoMS
Helper III
6 years ago
Solved

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

  • Anonymous's avatar
    Anonymous
    6 years ago

    JoaoMS 

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

    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.

5 Replies

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

     

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

  • Vvelarde's avatar
    Vvelarde
    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 

  • Anonymous's avatar
    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.

    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.