Hello
How can I change the sequence of the bars in the bar chart, for example for the "Others" bar in the below bar chart i would like to have it at the end. Is there any way to do this?
Thanks in advance,
Solved! Go to Solution.
Hi @sr12
The number at the end of your formula should be 11, not 10 .
You can number the sequence for column[Vertical], and then add this sequence column to your visual, so as to sort the bars in the visual through this sequence .
(1)Create a calculated column .
sequence =
SWITCH(TRUE(),'Table'[Vertical]="Residential",1,'Table'[Vertical]="Commercial",2,
'Table'[Vertical]="Banking",3,'Table'[Vertical]="Education",4,
'Table'[Vertical]="Entertainment/Sports",5,'Table'[Vertical]="Government",6,
'Table'[Vertical]="Healthcare",7,'Table'[Vertical]="Hospitality",8,
'Table'[Vertical]="Industrial",9,'Table'[Vertical]="Warehouses/Logistics",10,
'Table'[Vertical]="Others",11)
(2)Add the calculated column in Bar chart then sort by column [sequence] , select Sort ascending .
The final result is as shown :
I have attached my pbix file ,you can refer to it .
Best Regards
Community Support Team _ Ailsa Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @sr12
The number at the end of your formula should be 11, not 10 .
You can number the sequence for column[Vertical], and then add this sequence column to your visual, so as to sort the bars in the visual through this sequence .
(1)Create a calculated column .
sequence =
SWITCH(TRUE(),'Table'[Vertical]="Residential",1,'Table'[Vertical]="Commercial",2,
'Table'[Vertical]="Banking",3,'Table'[Vertical]="Education",4,
'Table'[Vertical]="Entertainment/Sports",5,'Table'[Vertical]="Government",6,
'Table'[Vertical]="Healthcare",7,'Table'[Vertical]="Hospitality",8,
'Table'[Vertical]="Industrial",9,'Table'[Vertical]="Warehouses/Logistics",10,
'Table'[Vertical]="Others",11)
(2)Add the calculated column in Bar chart then sort by column [sequence] , select Sort ascending .
The final result is as shown :
I have attached my pbix file ,you can refer to it .
Best Regards
Community Support Team _ Ailsa Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@sr12 , You can define on sequence /order by for vertical
new column=
Vertical 1= [Vertical]
Vertical sort = Switch(True() ,
[Vertical] ="residential", 1,
[Vertical] ="commerical", 2,
// Add other
12)
Mark vertical sort as sort column for vertical 1 and use that in the visual
refer, if needed
How to Create Sort Column and Solve Related Errors:
https://www.youtube.com/watch?v=KK1zu4MBb-c
I added the above cod ein the "add column" but i got an error as shown in the below picture, how can i fix it?
Can you please explain where to do this? I couldnt find the place to perform the above actions.
Please see this article.
Sort one column by another column in Power BI Desktop - Power BI | Microsoft Docs
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Thanks for sharing, but its not exactly what i want. I want to change the sequence of the bars to let the "Others" bar be at the end of the bar chart.
I should also mention that my table is an attribute as shown below: