Forum Discussion
How to Control the Bar Orders
How do I control the bar order? (I wanna group things that fall into a category adjacent to each other)
Thanks.
2 Replies
- danextian
Super User
Hi Anonymous ,
You need to custom sort the legend column by another column. In the screenshot below, I sorted the names of day from Sun to Sat using the WEEKDAY formula. You need to create a sort column either in DAX or M and use that as the custom sort. Please read this: https://www.techrepublic.com/article/how-to-sort-by-column-power-bi/
- Uzi2019
Community Champion
Hi Anonymous
you can create custom column by adding numbers against each value. like
1. Dairy
2. Breakfast
3. Lunch
etc.
You can use switch statement like below:
Initially I have similar chart but want to sort the legend according to my sorting order.Created calculated column
Sorting = SWITCH(TRUE(),WOW[Campaign Type]="SPONSORED_DISPLAY", "1.SPONSORED_DISPLAY",WOW[Campaign Type]="SPONSORED_PRODUCT","2.SPONSORED_PRODUCT",WOW[Campaign Type]="SPONSORED_BRAND_VIDEO","3.SPONSORED_BRAND_VIDEO",WOW[Campaign Type]="SPONSORED_BRANDS","4.SPONSORED_BRANDS")
If my post helps please give kudos and accept it as a solution!
thanks