Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
antoniodneto
Creator II
Creator II

RANK EXPRESSION HELP

Hey Guys!

Could you help me to solve my question?

I created a variable to rank my table

GRUPO&RATING&SCAN as SORTDIM

In my table I have these fields and two measures PDD and RISCO

I need to RANK the TOP 10 by PDD only and bring RISCO also.

My expression is

=Sum({$<SORTDIM6= {'=Rank(SUM(PDD))>=10'},CPFCNPJ-={0}>} PDD)/1000000

The expression works to RANK the values but some mistakes

One example is that returns the TOP 10 GRUPO but one GRUPO can have more than one RATING or SCAN, at the end my table shows more than 10 lines.

When I use other measures that have one value for all dimensions this expression works.

Follow an image

 

5 Replies
antoniodneto
Creator II
Creator II
Author

Channa
Specialist III
Specialist III

=If(Aggr(Rank(Sum(Sales)),COUNTR)<=10,COUNTRY) ===>Dimension
SUm(Sales)====>Measure


IF you look for Multiple dimensions you can make concatnation like below

Create one concatenate column in sript concatenate(Country,State) as CountryState

=If(Aggr(Rank(Sum(Sales)),CountryState)<=10,CountryState) ===>Dimension
SUm(Sales)====>Measure


another why based on two dimensions you can have more than 2

=If(Aggr(Rank(Sum(Sales)),State,Country)<=10,State,Country) ===>Dimension
it will bring top 10 states for each country

Hope this will help

Channa
antoniodneto
Creator II
Creator II
Author

Hi Channa Can you help me to build it?

My Dimensions are GRUPO,RATING,SCAN and my measures is RISCO and PDD.

I need to rank these dimension by RISCO.

How I create the expression using these 2 ways that you suggested?

Tks a lot!!

Channa
Specialist III
Specialist III

=If(Aggr(Rank(Sum(RISCO)),SCAN ,RATING,GRUPO)<=10,SCAN ,RATING,GRUPO)

Channa
antoniodneto
Creator II
Creator II
Author

Hi Channa,

Is not working.

Maybe is missing something.

qlik_rank_image3.png