Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
arusiva89
Contributor III
Contributor III

Rank Function

I came across this question in qlik practice test.I am confused with defining the number (mode,fmt) in rank function.4-lowest of all and number will be incremented 

 

A data architect needs to write the expression for a measure on a KPI to show the sales person with
the highest sales. The sort order of the values of the fields is unknown. When two or more sales
people have sold the same amount, the expression should return all of those sales people.
Which expression should the data architect use?
A. Concat(DISTINCT IF{Aggr{Rank{Sum(Sales),4),Salesperson)=1,Salesperson),' ')
B. FirstSortedValue{DISTINCT Salesperson,-Aggr{Sum(Sales),Salesperson))
C. Concat(DISTINCT IF{Aggr{Rank{Sum(Sales),1),Salesperson)=1, Salesperson) , ' ')
D. FirstSortedValue {Salesperson, -Aggr (Sum{Sales), Salesperson))

1 Solution

Accepted Solutions
sunny_talwar

@arusiva89 I think the answer should be C and that is because you want the same rank (= 1) for all the people who have the same Sum(Sales). mode 4 will give different rank to the same sum(Sales). For example, if we have A with Sum(Sales) = 100 and B with Sum(Sales) = 100, Rank(Sum(Sales), 4), will give them 1 and 2 rank, but for them to be ranked 1, you need Rank(Sum(Sales), 1)

View solution in original post

1 Reply
sunny_talwar

@arusiva89 I think the answer should be C and that is because you want the same rank (= 1) for all the people who have the same Sum(Sales). mode 4 will give different rank to the same sum(Sales). For example, if we have A with Sum(Sales) = 100 and B with Sum(Sales) = 100, Rank(Sum(Sales), 4), will give them 1 and 2 rank, but for them to be ranked 1, you need Rank(Sum(Sales), 1)