Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Live chat with experts, bring your API Integration questions. June 15th, 10 AM ET. REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
vijitbhargav
Contributor III
Contributor III

How to get Top 5 Sales?

Hi,

I am new to QlikView and trying to evaluate this simple scenario where I need to display top 5 sales by Product from the given data in a Bar Chart. (Please refer to the attached excel file Product_sales.xlsx).

I used two dimensions:

1. Product

2. =if(aggr(rank(sum(Sales), product)<=5, product)

Later in the expressions I simply used sum(Sales). But the same isn't working. Please assist.

Thank You.

1 Solution

Accepted Solutions
Gysbert_Wassenaar

If you want to use a calculated dimension instead of Dimension Limits then you need to use only the calculated dimension. So remove the product dimension. The expression for the calculated dimension should be =if(aggr(rank(sum(sales)),product)<=5,product). You'll also want to enable the option Suppress When Value Is Null for the calculated dimension.


talk is cheap, supply exceeds demand

View solution in original post

6 Replies
preminqlik
Specialist II
Specialist II

open chart select product as dimension
open dimension limits tab >> highlet the limits selection box, >>> show largest 5 values
open expression tab add your expression
go to sort tab ...sort the dimension with same expression as you entered in the expression tab.....with descending order...

Gysbert_Wassenaar

If you want to use a calculated dimension instead of Dimension Limits then you need to use only the calculated dimension. So remove the product dimension. The expression for the calculated dimension should be =if(aggr(rank(sum(sales)),product)<=5,product). You'll also want to enable the option Suppress When Value Is Null for the calculated dimension.


talk is cheap, supply exceeds demand

View solution in original post

vijitbhargav
Contributor III
Contributor III
Author

Hi..Thanks for the solution. it's working.

vijitbhargav
Contributor III
Contributor III
Author

Thanks Prem..working by setting dimension limits also. I also got a dynamic solution using calculated dimension. =if(aggr(rank(sum(sales)),product)<=5,product)

Not applicable

hi

i think this will help ful  to you

if yes

plz marked this as Answered Question

preminqlik
Specialist II
Specialist II

as per dimension limits the following additional result also works,

as per your soln,once check by  taking variable vTop and make scale with this variable and vary it

=if(aggr(rank(sum(sales)),product)<=$(vTop),product)

(when using dimension limits ,limit the largest value as =$(vTop))

regards

premhas