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
ivan_larson_cki
Helper III
Helper III

Sort by Column with different values for same item or add hidden characters

I have a matrix displaying various amounts broken down by three Row values, let's say Type.A, Type.B, and Item.C. Each value of Item.C has a ranking assigned it for its priority against other items in the same Type.A value. Within each Type.A, I'd like to see higher-priority Item.C's at the top of the list, but I want to see all Item.C's with the same Type.B and Type.A grouped together. Some Type.B values appear across different Type.A's, but I only want to organize by priority within each Type.A, not across them. To do this, I built a calculated column that determines for each Type.B/Type.A combination what the lowest ranking is on the associated Item.C's. I want to sort Type.B by this calculated column, but when I try to use Sort by Column, I get the error message that we can't sort by that column because it has more than one value for the same value in Type.B because priority can differ across different Type.A's.

 

The only ways I've thought of to bypass this limitation is to somehow add a more customized code for sorting regardless of what the rows are that's displayed (no clue how to do this), or to add hidden characters based on the Type.A values to the end of the Type.B values so that Power BI thinks they're different values but they display the same way to end users. Is that possible?

 

Sample data to clarify:

Sample Data Matrix Sorting.png

 

Current result:

Sample Matrix.png

 

Expected result (partial anyway, but should convey the idea):

Desired Matrix.png

 

1 ACCEPTED SOLUTION

Hi @ivan_larson_cki ,

 

You can consider to create a custom sort table and link to the raw table, then use related sort table fields as sort order:

Custom Sorting in Power BI

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

4 REPLIES 4
v-eachen-msft
Community Support
Community Support

Hi @ivan_larson_cki ,

 

You can create a new column to rank.

Column =
VALUE ( RIGHT ( 'Table'[Type.A], 3 ) ) * 1000000 + 'Table'[MIN RANK] * 1000 + 'Table'[Rank]

Here is the result.
4-1.PNG

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

Thanks. I've built out this column, but I'm still getting the error mesasge "There can't be more than one value in 'Column' for the same value in 'Type.B'. Please choose a different column for sorting or update the data in 'Column'."

Hi @ivan_larson_cki ,

 

You can consider to create a custom sort table and link to the raw table, then use related sort table fields as sort order:

Custom Sorting in Power BI

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

Thanks. I combined your advice with the use of hidden characters (added conditionally based on the Type.A value) to distinguish Type.B values by issue area, and was able to sort the table as needed.

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.