Latest Enterprise DNA Initiatives

Help sorting a text column by index value

I have a table:

I want to visualize the data by ATTRIBUTE. I created an INDEX to sort the text field. This is the view I want.

But when I remove the INDEX, the table looks like this:

I’m sure the solution is simple, but I cannot figure it out.

Any suggestions?


Welcome to the forum!

Really quick fix here:

Step one: in the Data View click on the Attribute column


Step two: under Column Tools, click on Sort by Column and choose Index


This will keep your Attribute column properly sorted, whether you have index in the table visual or not.


1 Like

Thank you, Brian!

What is tripping me up with your solution is the ATTRIBUTE column has identical values.
When I go to sort by INDEX, I receive an error message.

Will I have to create multiple tables by BRANCH to achieve the result I’m looking for without showing INDEX in the visual?


No, we can definitely get this to work within one table without the index in the visual.

Can you please post your PBIX file? I’ve got two different ideas on how best to handle this, and I want to test which one works better on your data.


  • Brian

Hi @rizzotony.

For Custom Sorting, I always prefer to use a MasterSort Table. Based on your data, I have created a new Table as below. (You can also create this table manually with Index 1,2,3 using Enter Data or DAX)

SortAttributeTable = 
    'DataTable'[ Attribute],
    "SortIndex", SUM ( 'DataTable'[Index] )

In Master table, we can Sort Attribute Column by SortIndex and use it in our Visuals.PF sample PBIX file attached. Let me know in case of any queries.

Solution - rizzotony.pbix (28.2 KB)

Ankit Jain



Nice. I was working this using CONCATENATE() to create the sort index in a calculated column in the Data table, but I like your approach better- cleaner and simpler.

  • Brian

@ankit & @BrianJ -

THANK YOU! Such a simple solution that has wide application.


1 Like