Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin 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.
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 suggestions
Solved! Go to Solution.
@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.
Proud to be a Super User! |
|
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
@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.
Proud to be a Super User! |
|
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.
I used "a"
this doesnt make sence
i think its a bug
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
77 | |
76 | |
57 | |
36 | |
34 |
User | Count |
---|---|
99 | |
56 | |
56 | |
46 | |
40 |