Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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*
Agent | Team | Sales | Rank |
Agent3 | Team1 | 150000 | 1 |
Agent1 | Team1 | 100000 | 2 |
Agent2 | Team1 | 40000 | 3 |
Agent5 | Team2 | 160000 | 4 |
Agent6 | Team2 | 120000 | 5 |
Agent4 | Team2 | 12000 | 6 |
But I actually want this:
Agent | Team | Sales | Rank |
Agent3 | Team1 | 150000 | 1 |
Agent1 | Team1 | 100000 | 2 |
Agent2 | Team1 | 40000 | 3 |
Agent5 | Team2 | 160000 | 1 |
Agent6 | Team2 | 120000 | 2 |
Agent4 | Team2 | 12000 | 3 |
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
Thanks in advance.