Forum Discussion
Need Help with 100% Stacked Bar chart
Hi Everyone,
I have a 100% Stacked bar chart viz in which the legend categories are 380 values to display the % for each company. Now I want to sort that to see only top 5 companies for each row. How can I do that ?
For example, for above chart for row 16 I want to see only top 5 contributor and similarly for each row.
Pls help me !
5 Replies
- Kishore_KVN
Solution Sage
Hello Vaishali0209 ,
You can create ranking for each category and then apply using filters on this visual. For example, I have created some sample data like this:
Product Sub-Product Sales Product 1 Product A 26 Product 1 Product B 25 Product 1 Product C 60 Product 1 Product D 15 Product 1 Product E 27 Product 1 Product F 99 Product 1 Product G 38 Product 1 Product H 37 Product 2 Product I 70 Product 2 Product J 65 Product 2 Product K 92 Product 2 Product L 36 Product 2 Product M 64 Product 2 Product N 48 Then created new column in Power BI desktop using below logic:
Top 5 Contributors = RANKX(FILTER('Table','Table'[Product]=EARLIER('Table'[Product])),'Table'[Sales])Then your output table looks as below:
Now in the report view, create your visual and under visual level filters add this new column and under advanced filtering provide lessthan or equal to 5 this will solve your requirement. Your output visual looks like this:
If this post helps, then please consider accepting it as the solution to help other members find it more quickly. Thank You!!
- Vaishali0209Regular Visitor
Hi Kishore_KVN
Thank you for your reply and providing me with the DAX formula. I tried that and now my visual is turning into below:Many rows are appearing blank, and i do not want that. Can you help me with that?
- Kishore_KVN
Solution Sage
Can you please show us the dummy sample data that you are using to create this visual.
- Vaishali0209Regular Visitor