Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Get Fixed Rank Regardless selection

Good morning people,

I've been facing a problem solving a fixed rank.

So I hope you can help me

I've attached an example so it will be simpler for you to understand my question.

I have 3 fields: Cod, Val1 and Val2.

fields.png

In table Rank, I have the sum of val1 and val2 for each cod. And I have the rank of that sum for each val.

Example:

rank.png

In the last two columns I have the sum of ranks of val1 and val2 for each cod, and the rank of this sum.

Example:

Cod A is 4th in Rank of Val1 and 2nd in Rank of val2, so, the sum of ranks is 4+2 = 6.

My idea is, the cod which has the less number of Total Ranks Sum is the best cod.

Which in this case gives me that cod B is the best cod.

So far so good?

Finally here comes my problem:

I want that, when I select a single cod, A, for example, the rank doesn´t change, it stays the same.

Example:

I've choose A and rank of Val1 and Rank of Val2 stayed the same:

a.png

But I can't find the way to keep "Rank of Total Ranks Sum" the same too.

Basically I want that when I choose A, "Rank of Total Ranks Sum" gives me value 3.

Can you please help me ?

Thanks in advanced,

Sílvia

1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

Try this expression.

Aggr(Rank( Sum({1}aggr(rank(sum({<Cod=>} Val1),0,1),Cod)+aggr(rank(sum({<Cod=>} Val2),0,1),Cod))*-1),Cod)

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!

View solution in original post

9 Replies
Anil_Babu_Samineni

This is ok for you

Capture.PNG

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

Try this expression.

Aggr(Rank( Sum({1}aggr(rank(sum({<Cod=>} Val1),0,1),Cod)+aggr(rank(sum({<Cod=>} Val2),0,1),Cod))*-1),Cod)

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Anonymous
Not applicable
Author

Hi Anil,

Sorry, but I guess I didn't get what your saying.

I want that when I select cod A, column "Rank of Total Ranks Sum", gives me the value 3.

rank highlight.png

So in Fixed Rank table should appear:

rank a with 3.png

Thanks,

Sílvia

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

Did you try the expression I gave.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
trdandamudi
Master II
Master II

Please use the solution that Kaushik provided and it will give you 3.

Anil_Babu_Samineni

Yes, The problem with Aggregation. Here, you've using without any filter aggregation flag. You may required Sum({1}...)

As Kaushik shared, It suits same as you expect

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable
Author

Hi !Kaushik,

I did try your expression, but is still not giving me 3.

I've attached the sample app.

Am I missing something?

Thanks,

Sílvia

trdandamudi
Master II
Master II

Please resize the last column and you will see 3. I just tried and it is working....

Anonymous
Not applicable
Author

I told you I was missing something

Thanks a lot