Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hello everyone,
I'm starting to build reports and I'm having some issues with changing the order of the legend in a bar graph. I have tried many of the options that I have found both in here and other sites, but haven't been able to do this for my case. The main issue here is that we also use the value of the legend as a slicer, so whenever I use one of the other options we lose the functionality of the slicer and can't seem to add another slicer that works for it.
Here is a general overview of the table:
MONTH | COST OPERATION A | COST OPERATION B | COST OPERATION C |
ene-19 | |||
feb-19 | |||
mar-19 |
I've tried using that table by adding each value in the order I want, but I can't seem to make another slicer and a filter for Top N.
The second table is a pivot of the first:
MONTH | OPERATION | COST |
ene-19 | OPERATION A | |
ene-19 | OPERATION B | |
ene-19 | OPERATION C | |
feb-19 | OPERATION A | |
feb-19 | OPERATION B | |
feb-19 | OPERATION C | |
mar-19 | OPERATION A | |
mar-19 | OPERATION B | |
mar-19 | OPERATION C |
Here I use Operation for the legend, however power bi sorts them in alphabetical order. I want the legend be sorted by the Cost value. Is it possible to do so?
Either of the cases would work for me since I'm trying to organize the legend and the bars by value and not alphabetical order.
Thank you in advance!
Hi, @Anonymous
Based on your description, I have created data to reproduce the scenario. It is unavailable to sort 'Operation' column in legend by the Cost value. The 'Operation' column should be based on another numeric column. You have to create an additional column "sort column" that just contains a simple integer value to provide a defined order to column values, such as an index column, a conditional column.
For further information, you may refer to the following links.
https://community.powerbi.com/t5/Desktop/Sort-legend/m-p/262395
https://community.powerbi.com/t5/Desktop/Sort-Legends/m-p/569548
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
You need to go into the table/data view, click in the column to be sorted, click "sort by column" and then select the surrogate sort column"
Stolen from here: https://community.powerbi.com/t5/Desktop/how-to-sort-a-column-by-other-column-which-is-not-used-in-t...
User | Count |
---|---|
126 | |
108 | |
99 | |
65 | |
62 |
User | Count |
---|---|
137 | |
116 | |
102 | |
71 | |
61 |