Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
ilanbaruch
Specialist
Specialist

Top 5 relative share in a bar chart

hi all

in my model i have a stacked bar chart with Year-Quarter as first dimension

and customer as second dimension.

i need an expression that will retrieve the top 5  customers for each quarter 

any ideas ?

advanced thanks

 

2 Replies
daanciorea
Partner - Contributor III
Partner - Contributor III

Try this
1. Create this variable:
vRank5 =chr(39)&Concat(aggr(If(Rank(aggr(expresion, customer, quarter)) <=5, customer), customer, quarter),', ')&Chr(39)
2. In your expresion add this in set analysis
customer = {$(vRank5)}

I hope that this will work correctly.

Dan.
pradosh_thakur
Master II
Master II

SUM({<customer ={"=rank(sum(Sales))<=5"}>}Sales)

 

or

SUM({<customer ={"=rank(sum(Sales),1,4)<=5"}>}Sales)   //depending upon your requirement

Learning never stops.