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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
BaltoLo
Helper I
Helper I

Sorting visual by column with letter prefix

Hello, i am trying to sort the following (Drill-Down) visual by the attribute UnterkapitelID of the following table

BaltoLo_2-1609380274989.png

 

BaltoLo_1-1609379895167.png

Since the ID contains letters, 10, 11, 12 etc. they sorted before 2,3,4 etc. To solve this problem I tried to create a new column, which in principle only removed the U. But I am not allowed to sort by that column, if I try to apply it to UnterkapitelID I create a circular dependency and on the other attributes there are duplicates.

BaltoLo_3-1609380472786.pngBaltoLo_4-1609380495687.png

 

Is there a simple way to solve this problem. I would like to avoid inserting a column in the database which is only for sorting. Furthermore, I would like to avoid having the column for sorting e.g. in the tooltip. The problem also occurs with other similarly structured tables and visuals.

 

Thanks in advance

 

5 REPLIES 5
v-rzhou-msft
Community Support
Community Support

Hi @BaltoLo 

If you want to sort text value, you may need to build a sort column.

You can build a sort column in Power Query Editor.

Here I have some advice.

1. You can duplicate UnterkapitelID and replace U by blank.

1.png

2. You can extract text after delimter U.2.png

And you need to change column type to whole number.

Then you can sort the ID column by this rank column.

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

For every table except the one in the post this works perfectly, thanks.
With the one in the example the Problem is that the Attribute Unterkapitel can not be sorted by the newly created row because of multiple values with the same name. I could sort the UnterkapitelID with vaule but that does nothing to the visual.
Can I somehow apply the sort by column Operator to the Attribute Unterkapitel.
It works if I put the sort row into the Tooltip, but I would like to avoid that. Since the table Unterkapitel is used in a Drill-Down-Visual I would also get the Tooltip on the upper level of the Drill-Down.
Can i somehow apply the sort by column Operator to the Attribute Unterkapitel.

Hi @BaltoLo 

Your sort by column option will show error, due to your Unterkapitel column has the same value.

You can try to merge KapitelID and Unterkapitel to get a new column to distinguish the same value.

My sample:

1.png

I duplicate  KapitelID and Unterkapitel columns and merge them to a new column.

We get MergedSort by extracting text after Delimiter U from UnterkapitelID and get KapitelIDSort by text after Delimiter K from KapitelID.

Then we can use sort by column function to sort KapitelID by KapitelIDSort column and sort Merged by MergedSort.

2.png

Drill-Down:

3.png

If this reply still couldn't help you solve your problem, please provide me a sample file. I need to know your drill down/up model and more details about your table.

You can download the pbix file from this link: Sorting visual by column with letter prefix

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

amitchandak
Super User
Super User

@BaltoLo , If you have create a column(B) from Column (A), then you can not sort Column A on B.

 

Do Like

A1 = [A]

B = sort using A

Then Sort A1 on B and use A1 in visual

 

Also A and B should have same granularity. Means 1-1 Mapping values 

 

 


Do Like

A1 = [A]

B = sort using A

Then Sort A1 on B and use A1 in visual

 


 What exactly do you mean by do A1 = [A] ?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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