Forum Discussion
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=NombreClienteAny suggestion to correctly sort my column alphabetically.
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:
9 Replies
- AlexisOlson
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.
- sebastianslzFrequent 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 Order Order A0002 - CEST A0012 - ARCET A0012 - ARCET A0002 - CEST A0015 - FULL A0015 - FULL - AlexisOlson
Super 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
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.- AlexisOlson
Super User
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: