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
sheikhbiuser
Regular Visitor

Power BI- Order Column with Repeative Values

I have 2 Columns, I am able to Sort Category Column by category ID but, Each Category has Position in it, and I also have PositionID against them and wants to sort Position  by Category and PositionID
Data is in below format.

How can I sort Position for each Category. ( Position do repeat for Different Category), so that when I put Category in Slicer , and Position in Report, I get Position is sorted Order by every Category Selected in Slicer.

 
 

OrderBy.PNG

5 REPLIES 5
Daviejoe
Memorable Member
Memorable Member

You could create a custom column with the below formula to give you a unique sort/index column

 

 

= ([Category ID] * 100) + [Position ID]





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




vanessafvg
Super User
Super User

you can create an index colum

create a new column
id = int(table[category] & table[position])

and then sort by id





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Not very Clear with your solution, Category and Position are text Column ? 
Also Created index Column will not order Position Column in Specific order we want , 

Can you share more detail ,if I am missing anything from ur post?

have you tried to use the calculated column that i suggested?

Can you specify what you are unsure of? it is not a text column as it is converted into an int, therefore the concatenation of the ids will sort it by number order in the order of the sequence of numbers.  However you will need to put it in your visual.  





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




I already Tried same thing (additing column with concat of CategoryID and Position ID  before posting his Question and use this for sorting ,but get error ,Because values like "Manager" and "VP" Repeats in Position Column.


Some how,I am not able to paste the screen shot ,of error .It says
" We cant sort the "Position"Columnn by "ID",There cant be more than one value in ID for same value in Position ,Please choose different column"
Can u try this on ur machine and check on this,Refer my Screen shot ,it has 4 column
Category,Position,CaregoryID,PositionID 

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.