Forum Discussion
How to customize sorting a bar chart by two columns
- 5 years ago
Interesting question. Here's a first approach to the solution. In fact, I had the idea of how you were using the tooltips, as the chart can be sorted by them without necessarily having to show them. Create an additional measure that will determine the sort order dynamically:
Sorting Measure = IF([Total Harvested]>0, 0, 100) + SELECTEDVALUE(Unit[UnitSort])This sets two blocks:
0 + Unit classification
100 + Unit Classification
The 100 can be changed, of course, as long as the two blocks can be differentiated correctly. You could also use decimals...
Then use that [Sort Measure] in the chart tooltip. You can now sort the chart by [Sort Measure] ascending and you will have the blocks in the desired order.
Now this will show [Sort Measure] in the tooltips. If that bothers you, as it is not user-relevant information (and could be confusing), you could hide the tooltip (all of them I'm afraid) and have the chart display the data labels so that all important information is displayed (I guess here to show [Total Harvested] and [Total Amount] in the tooltip is not an absolute requirement). You can also change the chart title so that it doesn't show all the tooltips. View everything at work in the attachment.
Let me know if you have any other ideas.
Please mark the resolved question when you are finished and consider giving a thumbs up if the posts are useful.
Contact me privately for assistance with any large-scale BI needs, tutoring, etc.
Bless you
This is elegant and exellent and what I was looking for. Great kudos and I am very grateful. Saved my day :-). Just one thing how did you add the pbix file. I had to copy the link to my onedrive but you have done it otherwise. How do you managed that 🙂
Anonymous
Attaching files is one of the (few) privileges bestowed upon Superusers 😎
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers