Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
prees959
Creator II
Creator II

Trying to Add a Ranking in Script

Hi,  I am using the following script to order and Rank a temporary table :

Ranked:

load AutoNumber([Area] & ' - ' & [DayOfWeek] & ' - ' & [Staff Type]) as Rank,

     [Area] & ' - ' & [DayOfWeek] & ' - ' & [Staff Type] as [Detail],

     sum([Total]) as [Total]

     Resident Detail_Data   

     group by  [Area],[DayOfWeek] ,[Staff Type];

When I look at this tables contents the autonumber isn't doing exactly what I intended.... the output is similar to this :

rank_version1.PNG

But, what I would ideally like to show is the following where the rank is split where the total is the same :

rank_version2.PNG

Can this be achieved??

Many thanks,

Phil

1 Solution

Accepted Solutions
sunny_talwar

May be you want this

Ranked:

LOAD AutoNumber(Total) as Rank,

     *;

LOAD [Area] & ' - ' & [DayOfWeek] & ' - ' & [Staff Type] as [Detail],

    Sum([Total]) as [Total]

Resident Detail_Data

Group By  [Area], [DayOfWeek], [Staff Type];

View solution in original post

3 Replies
sunny_talwar

May be you want this

Ranked:

LOAD AutoNumber(Total) as Rank,

     *;

LOAD [Area] & ' - ' & [DayOfWeek] & ' - ' & [Staff Type] as [Detail],

    Sum([Total]) as [Total]

Resident Detail_Data

Group By  [Area], [DayOfWeek], [Staff Type];

prees959
Creator II
Creator II
Author

Hi Sunny,

Thanks for your reply.  Unfortunately, I'm getting an error on the first part of the script

Field Not Found Total

If I comment out the first part the script runs but without the rank field...

Ranked:

//LOAD AutoNumber(Total) as Rank,

//    *;

LOAD [Area] & ' - ' & [DayOfWeek] & ' - ' & [Staff Type] as [Detail],

    Sum([Total]) as [Total]

Resident Detail_Data

Group By  [Area], [DayOfWeek], [Staff Type];

prees959
Creator II
Creator II
Author

Fixed it :

Ranked:

LOAD AutoNumber(sum(Total)) as Rank,

          [Area] & ' - ' & [DayOfWeek] & ' - ' & [Staff Type] as [Detail],

          Sum([Total]) as [Total]

Resident Detail_Data

Group By  [Area], [DayOfWeek], [Staff Type];



Thanks for your help again,

Phil