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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
geogou1973
Creator
Creator

Rank rows by step 2

Hello,

I have the following table 

DATE STORE ZONE SALES
1/1/2024 A1 A 7
1/1/2024 B1 A 20
1/1/2024 C1 A 10
1/1/2024 D1 A 15
1/1/2024 E1 A 30
1/1/2024 F1 A 12

 

and i want to create a new column in order the table to have the following format

DATE STORE ZONE SALES Rank
1/1/2024 A1 A 7 1
1/1/2024 B1 A 20 2
1/1/2024 C1 A 10 1
1/1/2024 D1 A 15 2
1/1/2024 E1 A 30 1
1/1/2024 F1 A 12 2

 

how can i have rank 1 and 2 for all the rows ?

Have anyone an idea how can i achive this ?

Thank you in advanced.

 

Labels (1)
1 Solution

Accepted Solutions
sk88024
Creator
Creator

Try this:

TEST:
LOAD *,
If(EVEN(RowNo()), 2, 1) as Rank;

Load * Inline [
DATE, STORE, ZONE, SALES,
1/1/2024, A1, A, 7
1/1/2024, B1, A, 20
1/1/2024, C1, A, 10
1/1/2024, D1, A, 15
1/1/2024, E1, A, 30
1/1/2024, F1, A, 12

];

View solution in original post

4 Replies
sk88024
Creator
Creator

Try this:

TEST:
LOAD *,
If(EVEN(RowNo()), 2, 1) as Rank;

Load * Inline [
DATE, STORE, ZONE, SALES,
1/1/2024, A1, A, 7
1/1/2024, B1, A, 20
1/1/2024, C1, A, 10
1/1/2024, D1, A, 15
1/1/2024, E1, A, 30
1/1/2024, F1, A, 12

];

geogou1973
Creator
Creator
Author

Hello again,

How can i achive the following table 

WHS DATE ZONE TIME SALES RANK
600 1/1/2024 A 11:10 7 1
600 1/1/2024 A 11:10 20 2
600 1/1/2024 A 12:00 10 1
600 1/1/2024 A 12:00 15 2
600 1/1/2024 B 13:15 30 1
600 1/1/2024 B 13:15 12 2
600 1/1/2024 B 14:30 50 1
600 1/1/2024 B 14:30 45 2
600 2/1/2024 A 12:10 7 1
600 2/1/2024 A 12:10 20 2
600 2/1/2024 A 12:30 10 1
600 2/1/2024 A 12:30 15 2
600 2/1/2024 B 14:20 30 1
600 2/1/2024 B 14:20 12 2
600 2/1/2024 B 15:45 50 1
600 2/1/2024 B 15:45 45 2
171 2/1/2024 A 7:10 120 1
171 2/1/2024 A 7:10 15 2
171 2/1/2024 A 7:30 78 1
171 2/1/2024 A 7:30 55 2
171 2/1/2024 B 8:15 23 1
171 2/1/2024 B 8:15 75 2
171 2/1/2024 C 9:00 80 1
171 2/1/2024 C 9:00 5 2

 

and Rank 1 and 2 by WHS, DATE, ZONE and TIME ;

 

geogou1973
Creator
Creator
Author

Hello,

i return with the same issue but i want to change the step from two to 3

i want to achieve the following table 

DATE STORE ZONE SALES Rank
1/1/2024 A1 A 7 1
1/1/2024 B1 A 20 2
1/1/2024 C1 A 10 3
1/1/2024 D1 A 15 1
1/1/2024 E1 A 30 2
1/1/2024 F1 A 12 3

 

Can you help me with that;

Thank you in advanced.

M_B
Creator
Creator

Try

TEST:
LOAD *,
Ceil(RowNo()/3) as GROUP;

Load * Inline [
DATE, STORE, ZONE, SALES,
1/1/2024, A1, A, 7
1/1/2024, B1, A, 20
1/1/2024, C1, A, 10
1/1/2024, D1, A, 15
1/1/2024, E1, A, 30
1/1/2024, F1, A, 12

];

 

Then add Aggr(RowNo(), GROUP, STORE) as a measure in your table chart and change the label to Rank.