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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
AlmantasPBIguy
Frequent Visitor

Different sort order per category

Hey guys, 

 

Lets say I have a table with 3 columns: Attribute, Category and Order and the order is different per category. I want to sort the attributes by the order, depending on what category is selected in the slicer. 

AlmantasPBIguy_0-1697808383456.png

Attaching a pbi example file also:

 

https://drive.google.com/file/d/1E8_zlZgmD0xbDk_A9Lhl3JGXA0-qx8ei/view?usp=share_link 

 



5 REPLIES 5
AlmantasPBIguy
Frequent Visitor

Hey, thank you everyone for the imput. I see the example I sent did not represent the full scope of the problem, because it left out, that the visual is a column chart and the value in the y axis is different from the sort order. 
I updated the power bi example file:

https://drive.google.com/file/d/1E8_zlZgmD0xbDk_A9Lhl3JGXA0-qx8ei/view?usp=share_link 

Can anyone help? 

v-rzhou-msft
Community Support
Community Support

Hi @AlmantasPBIguy ,

 

Here I will give you two workarounds.

1. Your issue should be caused by that you want to sort the same value in [Attribute] with different orders. Power BI doesn't support us to do this. We need to sort the unique key word with the order column. I suggest you to combine [Attribute] and [Category] column as a unique key column.

Combine = COMBINEVALUES("-",'Table'[Attribute],'Table'[Category])

vrzhoumsft_0-1698050365094.png

vrzhoumsft_4-1698050528526.png

2. You can turn off "Text wrap" in column headers and reduce the width of [Order] column in your visual.

vrzhoumsft_3-1698050502125.png

vrzhoumsft_1-1698050413755.png

vrzhoumsft_2-1698050469876.png

 

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.

Hey @v-rzhou-msft ,

 

thank you for the help. After trying to implement your solutions I realised I simplified my problem too much. 

It is a bit more complicated: the visual is a column chart and the value in the y axis is different from the sort order. I updated the example file to fit my problem more:
https://drive.google.com/file/d/1E8_zlZgmD0xbDk_A9Lhl3JGXA0-qx8ei/view?usp=share_link 

 

Is there a way to work around this? 

speedramps
Super User
Super User

Try this ... to add an invisible sort column

Turn off auto summarize on the order column,

Then drag the Order column to the far right of your visual.
Sort the visual by the Order column.
Then in the visual format settings,

click on Specific column,
Appliy settings to Series = Order

Apply to header = On

apply to values = On

text colour = white


speedramps_0-1697816351165.png

 

Thanks for the clear description of the problem with example data. I wish everyone did that!

 

Remember we are unpaid volunteers. So please click the thumbs up and the accept as solution button to leave kudos. 

 

If you give someone a fish then you only give them one meal, but if you teach them how to fish then they can feed themselves and teach others for a lifetime.  This is how I try answer Power BI and DAX questions with clear examples so your can learn techniques.

 

One question per ticket please. If you need to extend your request then please raise a new ticket.

 

You will get a quicker response and each volunteer solver will get the kudos they deserve. Thank you ! 

 

If you quote @speedramos in your next tickers then I will then receive an automatic notification, and will be delighted to help you again.

 

Please click the thumbs up and the accept as solution button. 

 

Hey, thank you for the reply. For the sake of brevety I used table as an example, but the original problem is with a clustered column chart. So this slick workaround will not work. Maybe there is a way to apply a similar solution? 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.