Forum Discussion

sebastianslz's avatar
sebastianslz
Frequent Visitor
4 years ago
Solved

How to sort alphabetize a concatenated column

I would like to sort alphabetize a column that is concatenated with another, that is, I am creating a custom column in which I am concatenating two columns.

 

The custom column formula I am using is the following:

= [IdCliente] & " - " & [NombreCliente]

The column I'm interested in alphabetizing is [NombreCliente]

Try to sort the column by [NombreCliente] making use of the function Order.Ascending as follows:

 

= [IdCliente] & " - " & Order.Ascending [NombreCliente]

But this is generated by an error indicating the following:

 

Expression.Error: Cannot apply field access to type Number.
Details:
    Value=0
    Key=NombreCliente

Any suggestion to correctly sort my column alphabetically.

9 Replies

  • Can you give an example of what your data looks like before sorting and what it should look like after you sort how you want? I'm not understanding why sorting on [NombreCliente] doesn't give you the order you want.

    • sebastianslz's avatar
      sebastianslz
      Frequent Visitor

      This is an example of how you would like the ordered data to look


      It is important to bear in mind that the value A0002 comes from the column [IdCliente] and the CEST value comes from the column [NombreCliente]

      Not OrderOrder
      A0002 - CESTA0012 - ARCET
      A0012 - ARCETA0002 - CEST
      A0015 - FULLA0015 - FULL
      • AlexisOlson's avatar
        AlexisOlson
        Icon for Super User rankSuper User

        OK. [NombreCliente] should still be in your table unless you've deleted it after defining the combined column. Sort the table using that column.

  • v-jingzhang's avatar
    v-jingzhang
    Icon for Community Support rankCommunity Support

    Hi sebastianslz 

     

    Do you want to change column sort order in visuals on report page? If so, you could use Sort one column by another column in Power BI Desktop feature. Select the concatenated column, sort it by NombreCliente. This is in Power BI Desktop not in Power Query Editor. 

     

    Best Regards,
    Community Support Team _ Jing
    If this post helps, please Accept it as Solution to help other members find it.