Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
urbanfaces
Contributor III
Contributor III

Rank and Variable Input

I have a variable called $VTop to pull the top 10 from a variable input box.

The variable is part of the ranking formula

Aggr(rank(sum(Value),$(Vtop)),Function,Name)

While it ranks the data, The variable input does not recognize the input.

I am new, so I just tried to figure things out, but they are not working.

Any help will be greatly appreciated.

Labels (1)
6 Replies
PhanThanhSon
Creator II
Creator II

Could u share a demo file?

Best regards Son

urbanfaces
Contributor III
Contributor III
Author

Thank you. Here you go

urbanfaces_0-1708623824540.png

 

PhanThanhSon
Creator II
Creator II

Hmm, maybe

try something like this:

Aggr(rank(sum(Value),'$(Vtop)'),Function,Name)

or this:

Aggr(rank(sum(Value),$(=Vtop)),Function,Name)

Could you also show how the editor interprets it?

PhanThanhSon_0-1708628251521.png

 

urbanfaces
Contributor III
Contributor III
Author

Thank you very much for your help. Both Formulas only ranked the result. On the print screen, you can see those outliers in Red are still listed. I would like it to exclude them when the Top 1 or 5 is input in the variable input. Now, it does not do that. You can see I input zero, and it just ranked the entire population.

urbanfaces_0-1708630246955.jpeg

 

PhanThanhSon
Creator II
Creator II

I think i understand your problem:

PhanThanhSon_0-1708632079719.png

Try something like this:

Sum( {<Name={"=Rank(SUM(ID),4)<=$(vTop)"}>} ID) Or in your case i guess something like this will help:

Sum( {<EmployeeName ={"=Rank(SUM(RecoveryKey),4)<=$(vTop)"}>} RecoveryKey)

Best regards Son

 

urbanfaces
Contributor III
Contributor III
Author

You are surely taking me in the right direction. But I will need a function as part of the calculation.

I have been following the Top N the example on YouTube, but I guess I lost.

 

While the example only looks at Brand and Sales

In my example. I group Function, Name on Sales

When I do the of

 

Rank(Sum(Sales), Function, Name)<=10

It tested for -1 and 0. -1 means the Sales falls within the Top 10

However, when I try to bring the actual result so I can use variable input, it does not work.

This is what I am using to try to filter the column for only the Top 10

Sum(

{<

Function, Name={“= Rank(Sum(Sales), Function, Name)<=10

”}

>}

Sales)