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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
sebastianslz
Frequent Visitor

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.

1 ACCEPTED SOLUTION

Yes, this did turn out to be what @sebastianslz was after:

https://stackoverflow.com/questions/69859428

 

Here's the screenshot I posted there for reference:

AlexisOlson_1-1636559236738.png

View solution in original post

9 REPLIES 9
v-jingzhang
Community Support
Community 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.

Yes, this did turn out to be what @sebastianslz was after:

https://stackoverflow.com/questions/69859428

 

Here's the screenshot I posted there for reference:

AlexisOlson_1-1636559236738.png

AlexisOlson
Super User
Super User

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.

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

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

I still have the column [NombreCliente] the order before creating the custom column but it is not sorted. Any other suggestions ?

I'm suggesting that you sort the table by the [NombreCliente] column.

Try sorting the [NombreCliente] column before concatenating it, but it still does not sort.


Are you looking at the sort in the query editor or are you trying to sort a report visual or something else?

 

Show me a screenshot of what you are seeing unsorted.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.