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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
altchung
Frequent Visitor

Reordering list

Hi Everyone,

 

I have a list which is shown below.  I can sort them Store Count (smallest to largest or vice versa), or Store Priority (alphabetically).

 

It there a way to write some code to customise the sort.  Ideally, I would like to sort them as follows - 

 

1. High Priority

2. Medium Priority

3. Low Priority

4. No replacement in Year 0

 

altchung_0-1623224217181.png

 

Many thanks,

 

Annie

3 REPLIES 3
AllisonKennedy
Community Champion
Community Champion

@altchung  You either need to add a new column in Power Query, or add a new table. 

 

For Power Query: 

Click Transform Data

In Power Query click Add Column tab in ribbon

Choose Conditional column

Put in your conditions for high, med, low, other so that each value in the existing column has a different number. Name this column [Priority Sort]

Close and Apply changes.

Click on the Store Priority column to activate the Column Tools tab in ribbon > Click Sort by Column > Choose the new [Priority Sort] column you just created. 

 

Now whenever you sort a visual by Store Priority, it will sort by the numeric column instead of alphabetically.


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Thank you for your response.  Apologies, I was not clear in my request.  I don't think I can use a conditional column as the priority is a calculated measure, which therefore doesn't appear in the Power Query.

Hi, @altchung 

Could you please share a sample pbix file and expected result for research?

 

Best Regards,
Community Support Team _ Eason

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Users online (5,853)