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
Anonymous
Not applicable

Custom Sort bar chart

Hello,  

I'm new to Power BI and trying  to sort the chart below by the following order: Agree, Strongly Agree, Neither Agree Nor Disagree, Disagree, Strongly Disagree. I have other statements that I would like to present in this order as well. Please advise.  

 

Thank you

mcPower BI Sort.jpg

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@Anonymous in Power Query add another field in your table. assuming your existing field is called "Status" and new column is called "Status Order"

 

if [Status] = "Agree" then 1 else
if [Status] = "Strongly Agree" then 2 else
if [Status] = "Neither Agree Nor Disagree" then 3 else
if [Status] = "Disagree" then 4 else
5

Close and apply the changes, go to modelling tab, select "status" field and choose sort by column option and select "Status Sort" column.

 

Your data will sort as per your need.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

7 REPLIES 7
parry2k
Super User
Super User

@saraammain yes, you need to create it in PQ.

 

👉Learn Power BI  YouTube.gif to our YT channel - @PowerBIHowTo



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Thanks, worked now 🙂 However, in order not to add numerous additional columns to my data table, in the end I created separate "sorting tables" (with two columns: names for the x-axis and index), connected them with my data table, used the new table for the x-axis and sorted the x-axis by the index column.

parry2k
Super User
Super User

@Anonymous in Power Query add another field in your table. assuming your existing field is called "Status" and new column is called "Status Order"

 

if [Status] = "Agree" then 1 else
if [Status] = "Strongly Agree" then 2 else
if [Status] = "Neither Agree Nor Disagree" then 3 else
if [Status] = "Disagree" then 4 else
5

Close and apply the changes, go to modelling tab, select "status" field and choose sort by column option and select "Status Sort" column.

 

Your data will sort as per your need.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Hi, when I do that, I get a circular dependency error when I try to sort. Could that be because I created the new order column in Power BI desktop instead of going to Power Query?

Anonymous
Not applicable

Hello,

I'm unclear on the steps below (new Power BI userSmiley Embarassed). Below is a snapshot of my data.  Will I need to create multiple status order columns for each statement?

Thank you for your help,

mc

Sort data.jpg

Hi @Anonymous 

Please check the two tables in attached file.They show two ways for you to order it.

First,create order columns in query editor for each Question column and sort by them.(Table1,Page1)

1.png

Second,unpivot your table first.Then create one sort column in query editor and sort by it.(Table2,Page2)

1.png

Regards,

 

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thank you! I'll try. Appreciate the quick response.

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.