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
LyndonTomas
Frequent Visitor

How to order the stacks in a stacked bar chart?

For context, I have a Power Bi report connecting to a Share Point list. For this one, I have a stacked bar chart containing the Status of each department. In my list, there are 2 columns "Status" and "Department". How can I order the stacks ina specific order based on this sequence, group by "Completed", "In-Progress", "Not Started", "On-Hold", "Cancelled".

Here is the bar chart for reference.

LyndonTomas_0-1682668051633.png

 

2 ACCEPTED SOLUTIONS
eliasayyy
Super User
Super User

create a new column in your table called order

order = SWITCH( 
               TRUE(),
               "Completed",1,
               "In-Progress",2,
               "Not Started",3,
               "On-Hold",4,
               "Cancelled",5
)
                       

 

after that, press on the column where you have the status and in the toolbar you will find "Sort Columb by",

press it and choose the "order" column

now go to your stacked report and sort by status ascending

View solution in original post

ValtteriN
Super User
Super User

Hi,

The legend sorting can be changed by chanhing the sort order of the column in your table. E.g.

Data:

ValtteriN_0-1682672058573.png

No sort:
(A to D)

ValtteriN_1-1682672095947.png

 

Sort by column2:
(D to A)

ValtteriN_2-1682672134049.png

ValtteriN_3-1682672149158.png

So in your case you can create a new column with values for department statuses (e.g. numbers 1 to 5) and use that for sorting.

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/





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

Proud to be a Super User!




View solution in original post

2 REPLIES 2
ValtteriN
Super User
Super User

Hi,

The legend sorting can be changed by chanhing the sort order of the column in your table. E.g.

Data:

ValtteriN_0-1682672058573.png

No sort:
(A to D)

ValtteriN_1-1682672095947.png

 

Sort by column2:
(D to A)

ValtteriN_2-1682672134049.png

ValtteriN_3-1682672149158.png

So in your case you can create a new column with values for department statuses (e.g. numbers 1 to 5) and use that for sorting.

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/





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

Proud to be a Super User!




eliasayyy
Super User
Super User

create a new column in your table called order

order = SWITCH( 
               TRUE(),
               "Completed",1,
               "In-Progress",2,
               "Not Started",3,
               "On-Hold",4,
               "Cancelled",5
)
                       

 

after that, press on the column where you have the status and in the toolbar you will find "Sort Columb by",

press it and choose the "order" column

now go to your stacked report and sort by status ascending

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.

Top Solution Authors