I have a line chart with monthly granularity over a year. I need the legend at the top of the chart to sort by the count of items in each category and for the tooltip to sort by count of items in each category at the monthly level. I tried creating a rank column that has the desired granularity for monthly but it breaks the line chart, and if I try the yearly level the tooltip is out of order. If I try to sort the category column itself by the monthly column I get the error about not having multiple values in Y for sorting X. Is there any way to sort the legend by the values and not the categories?
You can use sort column by another column feature; furthermore, you can also create a custom sort order by creating a new sort column. Then use the visual option "Sort Legend".
You can refer to the following blogs and videos to help you.
Sort Legend Power BI Feature Tutorial And Review
Community Support Team _ Zeon Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
So the problem I have with this is that my Values on my line chart is a Count of the values in another column, and that second column has many duplicate values which gives me the error that 'There can't be more than one value in Column A for the same value in Column B" if I try to use it as the Sort By for Column A.
See below the issue I have with the Legend/Tooltip behavior, it only sorts by alphabetical of the legend items, I need to sort by value of the legend items:
Here's a PBIX with sample data that fits the pattern I am working with. I need to sort Animal by Count of Sequence in the Tooltip so that when you hover over the line chart the items are in order of the values and not alphabetical, as indicated in my graphic. Thank you.
@wcarter Thank you for providing the sample data. That helps a lot with proposing a potential solution.
See attached for a possible implementation with tooltip pages.
You can only sort a column by another column. If you want to sort a visual by a measure then you need to put that measure in the visual, or in the tooltips area.
Please provide sanitized sample data that fully covers your issue.
Please show the expected outcome based on the sample data you provided
Check out the November 2023 Power BI update to learn about new features.
Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.
Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!
130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.