Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
infock12
Creator III
Creator III

Ranking expression

Hello all,

I am using the following expression: The dimension is a student name.

Num(count({<Ratings={'>=7'}>} Questions)/Count(Questions), '0.00%')

When two students have the same percentages, i.e., ranked 2, Qv puts one on top of the other. I wanted to add a column to show their ranks are the same. For example,

John  - 99%    - 1

Jo      - 98.6% - 2

Joe    - 98.6% - 3

I know I may have to use rowno() and rank() function but now sure how. Any help is appreciated.

8 Replies
infock12
Creator III
Creator III
Author

Sorry friends,

I made an error in the previous post. I would like that extra ranked column to show

John  - 99%    - 1

Jo      - 98.6% - 2

Joe    - 98.6% - 2 (mentioned as 3 in the previous post)

Thanks,

sunny_talwar

May be try with AutoNumber()

LOAD Name,

          Percentage,

          AutoNumber(Percentage) as Ratings Rank

FROM Source

Gabriel
Partner - Specialist III
Partner - Specialist III

Hi,

Are you calculating the percentage in the script?

infock12
Creator III
Creator III
Author

Hi Gabriel,

No, I am calculating in the Expression tab.

Thanks,

Karthik

Gabriel
Partner - Specialist III
Partner - Specialist III

I will suggest you move the calculation to script.

You can then use the Peek() function and RowNo() to Rank.

Moving the calculation to Script helps the App to perform better

Please post a sample data so that community can help with solution

infock12
Creator III
Creator III
Author

Hi Gabriel,

Here is the attached qvw and sample data

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi

use Rank function

Rank(COUNT({<Marks={'>=7'}>}GID)/Count(GID))

or

Rank(COUNT({<Marks={'>=7'}>}GID)/Count(GID), 1,1)

Gabriel
Partner - Specialist III
Partner - Specialist III

Hi,

I think you achieve your requirement in UI as well.

What I did is to add another calculation as below

=if(above(Num(COUNT({<Marks={'>=7'}>}GID)/Count(GID), '0.00%')) = Num(COUNT({<Marks={'>=7'}>}GID)/Count(GID), '0.00%'),RowNo(TOTAL) -1, RowNo(TOTAL))

Try it