Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Top and Rank

Hi

I have 2 questions.

Firs: Maybe do you know how through button I can  to select in filter (list) thise products ( top 4)

But I don't understand why I see 3 products, if my exspression - Product = {"=Rank(Sum(volumn))<=4"}

Мй.png

and

Second

How Qv selects which display in top product, if they are of equal value

v2.png !

1 Solution

Accepted Solutions
petter
Partner - Champion III
Partner - Champion III

Then this should do the trick:

2017-01-03 09_23_32-Edit Expression.png

View solution in original post

8 Replies
stabben23
Partner - Master
Partner - Master

Hi,

if you add rank in Your straight table you see that you have 3 Product that is <=4.

rank.GIF

If they have the same value, qlikview wont know who to display, both will be visible.

pathiqvd
Creator III
Creator III

Hi,

       If you want to show top 3 products volumn. don't use rank function in expressions use in add calculated dim, try below this

Add calculated dim:- =if(aggr(rank(sum(volumn)),product)<=3,product)

exp:-   sum(volumn)

regards,

Not applicable
Author

I want, if I click on the button  "Rank", in list i see product like to text object  ( first questions)

petter
Partner - Champion III
Partner - Champion III

Rank() function can take two additional parameters: mode and fmt

The documentation explains the additional parameters and how they affect the ranking:

http://help.qlik.com/en-US/qlikview/12.1/Subsystems/Client/Content/ChartFunctions/RankingFunctions/r...

In your textbox you will have to use this expression to get all four top ranking products:

=Concat(DISTINCT {<Product = {"=Rank(Sum(volumn),4)<=4"}>} Product, ' | ')

Notice the added second parameter to Rank in this expression. Mode=4 which means that every ranked product should get a unique ranking even if two or more products rank equally. With you Rank with no additonal parameters you will get a numeric ranking of 1 to 3 for each product and the rest of the products are ranked from 5 and upwards - it leaves a missing rank of 4 since two products are ranked as 1.

For your second question - you can by using the additional mode parameter to choose whether you will have the same ranking value for two or more products that have equal ranking or if they should have unique rankings even if they are equal. They will then be ranked according to sort order in your chart.

Notice also that Rank returns dual values - both a text and a number.

I have attached a modified QlikView app to illustrate a little bit:

2017-01-03 08_42_48-QlikView x64 - [C__Users_psd_Downloads_Rank and button.qvw_].png

petter
Partner - Champion III
Partner - Champion III

I updated you sample application to work with a button too - see attached QVW...

pathiqvd
Creator III
Creator III

Hi,

    Try this in text object

create one variable like vBT after create button and write below condition in ext object

=if(vBT=0,concat(if(aggr(rank(sum(volumn)),product)<=3,product),'|'))

Regards,

Not applicable
Author

thanks, but I want

button effect on the list

Clip2net_170103110252.png

petter
Partner - Champion III
Partner - Champion III

Then this should do the trick:

2017-01-03 09_23_32-Edit Expression.png