Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Rank through RowNo() and partition / group by

Hello,

I have a table of sales agents who belong to different teams and I want to rank them by their sales within their respective teams.

How can I rank these agents within their teams through the LOAD script so that their ranks are static? I imagine there must be some PARTITION BY clause that allows me to group the rows by the Team dimension.

I tried creating two separate LOAD scripts and concatenating them but RowNo() seems to be operating on the concatenated table rather than the two tables before the concatenation.

e.g. the following script would give me this:

Rank:

LOAD
Agent
,
Team
,Sales
,
RowNo() as Rank
Resident AgentSales
WHERE Team = 'Team1'
ORDER BY
Sales DESC
;

CONCATENATE(Rank)

LOAD
Agent
,
Team
,Sales
,
RowNo() as Rank
Resident AgentSales
WHERE Team = 'Team1'
ORDER BY
Sales DESC
;

   

*edited submission*   

AgentTeamSalesRank
Agent3Team11500001
Agent1Team11000002
Agent2Team1400003
Agent5Team21600004
Agent6Team21200005
Agent4Team2120006

But I actually want this:

   

AgentTeamSalesRank
Agent3Team11500001
Agent1Team11000002
Agent2Team1400003
Agent5Team21600001
Agent6Team21200002
Agent4Team2120003
10 Replies
KD2015
Contributor II
Contributor II

Hello Sunny & everyone, I am new to Qlik & I have a load script requirement which I have been able to solve with your AutoNumber() & Order By clause recommendations here. However, I have some ties within the ranks & I was wondering if there is a way to skip however many values that are tied when counting the next rank number (e.g. 1,2,3,3,5). I have looked everywhere but I can't find the load script solution. I tried to use Peek() but it produced inaccurate results since the ranked field (Days_w_Excellent_Score) is aggregated & grouped as seen below

KD2015_1-1714885603466.png

Thanks in advance.