Forum Discussion
Sort hierarchy for 2 different counts on stacked bar chart
Hello,
I have a stacked bar chart where I am trying to rank Organization by count of Programs and Count of Applications, so I have 2 columns/colors/counts showing up in each bar. I am able to sort by using the Top N advanced filtering option for the Count of Programs, but some Programs can have multiple applications within them, so 3 organizations could each have 5 Programs, but then Organization 1 could have 5 applications, Organization 2 could have 8, and so on. I would like to be able to also order the organizations by application as a secondary sort. What is the best way to go about this? Most info on sorting that I've found involves doing something in the dataset, but in this situation my columns aren't summarized by count until I add them to the visual.
1 Reply
- speedramps
Super User
Try this
Rank by program and application= VAR Myprogram = SELECTEDVALUE(yourtable[program]) VAR Myapplication= SELECTEDVALUE(yourtable[District]) RETURN RANKX( FILTER(ALLSELECTED(yourtable), yourtable[program] = Myprogram && yourtable[District] = MyDistrict), CALCULATE(SUM(yourtable[youramount])), ,DESC, Dense )
Please click thumbs up abd also the accept as solution button. Thank you `