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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
IanCockcroft
Post Patron
Post Patron

Sorting Error: Can't be more than one value in 'x' for the same value in 'y'

Hi all,

I am trying to sort a text column by an index and get an error. i have tried all the solutions sggested but still the error.

I even tried to remove all  the columns and only had 1 row.

no luck 

 

any suggestionssc sort.JPG

1 ACCEPTED SOLUTION
bhanu_gautam
Super User
Super User

@IanCockcroft If it is not possible to ensure unique values in the 'Index' column, consider sorting the 'Line Item' column by a different column that does have unique values.

 

If you need to maintain the current structure, you can create a composite key by combining multiple columns to ensure uniqueness. For example, you can concatenate the 'Line Item' and 'Index' columns to create a new column with unique values.

 

CompositeKey = CONCATENATE([Line Item], [Index])

 

Then, you can sort the 'Line Item' column by this new 'CompositeKey' column.

 




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

3 REPLIES 3
danextian
Super User
Super User

Hi @IanCockcroft 

Sorting a column value by multiple sort values is not allowed in the GUI but is actually possible with Tabular Editor. Another workaround is to concatenate invisible a no-width space character which is repeated several times based on the sort column to the text.

Line Item2 = 
REPT ( UNICHAR ( 8203 ), 'Table'[Index] ) & 'Table'[Line Item]

For the sake of illustration, I duplicated "Profit / (loss) before indirect tax" and assigned multiple sort values to it. You can see in the image below that this text appears twice or so it seems. The first one has 27 invisible characters at the beginning while the other has 29

danextian_0-1742558874085.png

danextian_1-1742558891648.png

 

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
bhanu_gautam
Super User
Super User

@IanCockcroft If it is not possible to ensure unique values in the 'Index' column, consider sorting the 'Line Item' column by a different column that does have unique values.

 

If you need to maintain the current structure, you can create a composite key by combining multiple columns to ensure uniqueness. For example, you can concatenate the 'Line Item' and 'Index' columns to create a new column with unique values.

 

CompositeKey = CONCATENATE([Line Item], [Index])

 

Then, you can sort the 'Line Item' column by this new 'CompositeKey' column.

 




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Thanks Bhanu, that worked, but with a slight change

I got a circlar loop refernce initially if I use the column i want to sort in the CONCATE.

sc sort.JPG

 

I used "a" 

this doesnt make sence

i think its a bug

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.