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.
Hi All,
I'm trying to sort the clustered bar chart based with below sample dataset in Power Bi,
Customer | Group | Sales |
AA | A | 500 |
AB | A | 50 |
AC | A | 200 |
AD | A | 2000 |
BB | B | 1000 |
BQ | B | 500 |
BA | B | 400 |
The original chart available in Power Bi will be looking like this, and only limited sorting options are available (by Sales / by Customers' name alphabetically.
**I generated similar output by using excel
I'm trying to achieve sorting like below. Sort the sales in descending orders within each customer groups. Couldn't find any solutions through online so far, appreaciate that if someone could help to advice on this.
Thanks in advance!
Solved! Go to Solution.
Hi @JOO13 ,
Add a calculated column to above sample dataset.
Rank Col = COUNTROWS ( FILTER ( Test_9, Test_9[Sales ] <= EARLIER ( Test_9[Sales ] ) && Test_9[Group] = EARLIER ( Test_9[Group] ) ) )
Choose [Customer] field, click "Sort by Column", choose "Rank Col" from the list.
Chart preview.
Best regards,
Yuliana Gu
Hi @JOO13 ,
Add a calculated column to above sample dataset.
Rank Col = COUNTROWS ( FILTER ( Test_9, Test_9[Sales ] <= EARLIER ( Test_9[Sales ] ) && Test_9[Group] = EARLIER ( Test_9[Group] ) ) )
Choose [Customer] field, click "Sort by Column", choose "Rank Col" from the list.
Chart preview.
Best regards,
Yuliana Gu
Thanks a lot for the recommendations. It's a good idea but unfortunately it won't work for my case as the "Sales" is a measures.
Hi JOO13,
You can create a condtitional column (Sort_Order). For example in your case
AD =1
AA =2
AC =3
AB =4
BB =5
BQ =6
BA =7
Create a condtional column as per the above format and then do sorting of Customer with respect to Sort_Order Column. I hope your issue will be resolved using this approach.
Thanks for the recommendations. It's a good idea but unfortunately it won't work for my case as "Sales" is a Measure.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
100 | |
80 | |
64 | |
57 |
User | Count |
---|---|
146 | |
110 | |
93 | |
84 | |
67 |