Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor III
Contributor III

Rank Logic & Dimension Limits both are giving wrong result for similar Ranks

Hi All,

First, I tried with Dimension Limits but it wqas giving wrong result for similar Ranks. I want to see all Rank1 Names but it was giving only 1.

Then I tried Rank Function. 

I need all the Rank 1 Names in my Chart but using below expression

in calculated dimension is giving me only 1 result which is wrong.

=aggr(if(Rank(Sum(Value),4,1)<=1,Name),Name)

Here is the sample snapshot:'

Rank - Community.png

Need help in understanding this Rank & fixing this issue.

Regards,

Eric

Labels (3)
1 Solution

Accepted Solutions
Highlighted
MVP
MVP

@erric3210  try below

=num(rank(total sum(Sales),1))

View solution in original post

7 Replies
Highlighted
MVP
MVP

@erric3210  try below

=num(rank(total sum(Sales),1))

View solution in original post

Highlighted
Contributor III
Contributor III

Hi Kush,

Thanks for the solution. It worked.

Can you please explain me what is the role of TOTAL here.

I've tried with your expression, without Total also it is working 

and if possible can you please make me understand that why below expression was not working

=aggr(if(Rank(Sum(Value),4,1)<=1,Name),Name)

 

Regards,

Eric

Highlighted
Contributor III
Contributor III

Hi Kush,

Can you please make me understand why Mode 4 is not working and 1 is working. I can clearly see that Mode 4 is giving similar values for Same value and it's not using range but still it's not going right result when using <=1 condition and mode 1 is working when it has values in ranges. how come it is showing values 5 values in <=1 when in actual it is representing them as 1-5.

Is 1-5 internally interpreted as 1 and Mode1 rank 1 are interpreted differently internally?

Here is the snapshot:

Rank Ligic_1.png

Regards,

Eric

Highlighted
MVP
MVP

@erric3210  you can read more about rank function parameter here 

You can ignore total keyword and you can also use below where mode =1 provides lowest rank on all rows and format=1 gives low value on all rows

 

=rank(total sum(Sales),1,1))

or

=rank( sum(Sales),1,1))

 

 

Highlighted
Contributor III
Contributor III

Hi Kush,

Thank you for the solution & explanation.

I'll surely read the shared link.

Kush, earlier you've used only 1 value in the end  (=num(rank(total sum(Sales),1)))

and also removed Num function from 2nd expression.

but now you're using 2 values in the end (=rank(total sum(Sales),1,1)))

What is the difference b/w them.

Regards,

Eric

Highlighted
MVP
MVP

@erric3210  only difference is in second solution I have used second format parameter which you can use to avoid using num function in first solution

Highlighted
Contributor III
Contributor III

Great....!! Thanks Kush..........!!