Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Show top 10 categories based on specific value of dimension 2 in 100% stacked bar chart

Hi,

I have a stacked bar chart with two dimensions -

Dimension 1 - Product Categories

Dimension 2 - Sub products - A,B,C

Measure - Count of unique id [ I have used expression in order to show 100% stacks - Count([Unique Id])/count (total <Product Category> [Unique Id])

So my 100% stacked chart has y-axis as Product categories and and color of bars is sub product and x-axis as id%.

I need to show top 10 product categories which has highest % of B. Can you tell how can I write this expression

3 Replies
vikasmahajan

=sum(aggr(if(rank(count([Unique Id])))<=10,count( [Unique Id])), [Dim1],[Dim2]))

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
Not applicable
Author

Hi Vikas,

This expression will not sort based on values of 'B' [ Dim2=B]

How can I modify it to show top 10 Dimennsion 1 based on % of B

sunny_talwar

May be this

If(Rank(Count({<[Sub Product] = {'B'}>} [Unique Id])/Count(TOTAL <[Product Category]> [Unique Id])) < 11, Count([Unique Id])/Count(TOTAL <[Product Category]> [Unique Id]))