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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
ozziecrobar
New Member

Changing order of rows on bar chart

ave several PowerBI charts gauging sentiment amongst our stakeholders, but I can only sort them based on numbers responded. I want the order of the axis to run - Very Good - Good - Remained Same - Poor

How do I reformat / reorder the order of the rows on the bar chart?

 

sentiment chart.png

2 ACCEPTED SOLUTIONS
Jai-Rathinavel
Super User
Super User

Hi @ozziecrobar 

1. You can create a conditional column called "Review Sort" on the Power Query level to have the Sort order in place. 

2. Go to your Bar graph and sort it based on Review

JaiRathinavel_0-1748500639583.png

3. Then go to Data View and Choose the review column and Click Sort By Column -> Review Sort

JaiRathinavel_1-1748500786945.png

 

Thanks,

Jai Rathinavel | LinkedIn




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

Proud to be a Super User!





View solution in original post

Bibiano_Geraldo
Super User
Super User

Hi @ozziecrobar , assuming that the name of column in Y-Axis is Sentiment.

1- In Power Query Editor, go to "Add Column" > "Custom Column".

2- Name the new column something like SentimentOrder.

3- Paste the code bellow and click OK

if [Sentiment] = "Very Good" then 1
else if [Sentiment] = "Good" then 2
else if [Sentiment] = "Remained Same" then 3
else if [Sentiment] = "Poor" then 4
else 99
  • The 99 is the default value that will be assigned if none of the specified cases match.

Important: Make sure that the created column as Whole Number as DataType.

 

Close and apply.

  • Select the Sentiment column.
  • Go to the "Column Tools" tab.
  • Click "Sort by Column" and select SentimentOrder.

 

View solution in original post

7 REPLIES 7
v-kpoloju-msft
Community Support
Community Support

Hi @ozziecrobar,
Thank you for reaching out to the Microsoft fabric community forum. Thank you @Nasif_Azam@grazitti_sapna@Bibiano_Geraldo@Jai-Rathinavel, for your inputs on this issue.

After thoroughly reviewing the details you provided, I reproduced the scenario again, and it worked on my end. I used it as sample data and successfully implemented it.

Sort the Category Column by the Sort Column: Now tell Power BI to use this custom order:

  • Select the Sentiment column in the Fields pane
  • Go to the ribbon → click Column Tools
  • Click "Sort by Column" → choose SortOrder


outcome:

vkpolojumsft_0-1748520823015.png

I am also including .pbix file for your better understanding, please have a look into it:

If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.

Thank you for using Microsoft Community Forum.

Nasif_Azam
Super User
Super User

Hey @ozziecrobar ,
By default Power BI has 2 option to sort a visual and 1 customized option which are:
1. Sort By Number:

Nasif_Azam_2-1748502417730.png

 

2. Sort By Alhapetical Order:

Nasif_Azam_1-1748502341312.png

 

3. Custome Sorting: If you want to sort axis or rows or columns as your need, you have to create a DAX measure to sort things as a custome way. 

To reorder the bars on your Power BI bar chart (like in your image) to a custom order such as:

Very Good → Good → Remained the same → Poor

You need to create a custom sorting column and then use that for sorting. 

 

1. Go to Power BI Desktop → Data View.

2. Select your sentiment column, e.g., "SentimentRating" with values like: Very Good, Good, Remained the Same, Poor

3. Create a new column (e.g., "SortOrder") with a sort index:

SortOrder =
    SWITCH(
    [SentimentRating],
    "Very Good", 1,
    "Good", 2,
    "Remained the Same", 3,
    "Poor", 4,
    99 // Default if none match
)

4. Select the "SentimentRating" column in the Fields pane.
5. Go to the "Column tools" tab.
6. Click "Sort by Column" → Select "SortOrder".

7. Go back to your bar chart.
8. Use "SentimentRating" on the axis.

 

If you found this solution helpful, please consider accepting it and giving it a kudos (Like) it’s greatly appreciated and helps others find the solution more easily.


Best Regards,
Nasif Azam

 

 



Did I answer your question?
If so, mark my post as a solution!
Also consider helping someone else in the forums!

Proud to be a Super User!


LinkedIn
grazitti_sapna
Super User
Super User

Hi @ozziecrobar 

1. Create a Custom Sort Column:

SentimentOrder =
  SWITCH(
    [Sentiment],
    "Very Good", 1,
    "Good", 2,
    "Remained the Same", 3,
    "Poor", 4,
    5
  )

2. Sort by the New Column:

Go to the Data view in Power BI
Click on your Sentiment column.
Then go to the ribbon and select:
Modeling > Sort by Column > SentimentOrder



🌟 I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.
💡 Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.
🎖 As a proud SuperUser and Microsoft Partner, we’re here to empower your data journey and the Power BI Community at large.
🔗 Curious to explore more? [Discover here].
Let’s keep building smarter solutions together!

Bibiano_Geraldo
Super User
Super User

Hi @ozziecrobar , assuming that the name of column in Y-Axis is Sentiment.

1- In Power Query Editor, go to "Add Column" > "Custom Column".

2- Name the new column something like SentimentOrder.

3- Paste the code bellow and click OK

if [Sentiment] = "Very Good" then 1
else if [Sentiment] = "Good" then 2
else if [Sentiment] = "Remained Same" then 3
else if [Sentiment] = "Poor" then 4
else 99
  • The 99 is the default value that will be assigned if none of the specified cases match.

Important: Make sure that the created column as Whole Number as DataType.

 

Close and apply.

  • Select the Sentiment column.
  • Go to the "Column Tools" tab.
  • Click "Sort by Column" and select SentimentOrder.

 

Thanks for this, you explained it very clearly and I customised your reponse to my parameters and it worked. Very happy! ( I just now have to apply this to about 20 different barcharts but at least once it is done, it is done!) . 
Am now ready to do more epxerimentation with DAX

Jai-Rathinavel
Super User
Super User

Hi @ozziecrobar 

1. You can create a conditional column called "Review Sort" on the Power Query level to have the Sort order in place. 

2. Go to your Bar graph and sort it based on Review

JaiRathinavel_0-1748500639583.png

3. Then go to Data View and Choose the review column and Click Sort By Column -> Review Sort

JaiRathinavel_1-1748500786945.png

 

Thanks,

Jai Rathinavel | LinkedIn




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

Proud to be a Super User!





BhavinVyas3003
Super User
Super User

Create a Sort Order column:

SortOrder =

SWITCH(

    'YourTable'[Sentiment],

    "Very Good", 1,

    "Good", 2,

    "Remained the Same", 3,

    "Poor", 4

)

Sort the Sentiment column by SortOrder:
In Data view → select Sentiment → click "Sort by Column" → choose SortOrder.

Use Sentiment in the chart – it will now follow your custom order.


Thanks,
Bhavin
Problem solved? Hit “Accept as Solution” and high-five me with a Kudos! Others will thank you later!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.