Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Row Number Help

Hi Experts

I am using Rowno() in my Script as Rank

I want to get an output of  the following

How Can I Achieve this Please Help

      

BranchcutomerMonthRankTSalesExpected Rank
11101Jan 2015122511
11101Feb 2015222822
11101Mar 2015323103
11101Apr 2015423414
21102Jan 2015522525
21102Feb 2015622831
21102Mar 2015723112
21102Apr 2015823423
31103Jan 2015922531
31103Feb 20151022842
31103Mar 20151123123
31103Apr 20151223434
41104Jan 20151322541
41104Feb 20151422852
41104Mar 20151523133
41104Apr 20151623444
51105Jan 20151722551
51105Feb 20151822862
51105Mar 20151923143
51105Apr 2015202345

4

6 Replies
swuehl
MVP
MVP

Try autonumber

LOAD Branch,

        customer,

       Month,

        TSales,

      Autonumber(recno(), customer) as Rank,

      ...

FROM ...;

sunny_talwar

Try this script:

Table:

LOAD Branch,

    cutomer,

    Month,

    Rank,

    TSales

FROM

[https://community.qlik.com/thread/169775]

(html, codepage is 1252, embedded labels, table is @1);

Table2:

LOAD *,

    Alt(If(Branch = Peek('Branch') and cutomer = Peek('cutomer'), Peek('New Rank') + 1), 1) as [New Rank]

Resident Table

Order By Branch, cutomer, TSales;

DROP Table Table;

Anonymous
Not applicable
Author

load the following

autonumber(Recno(),Branch) or autonumber(Recno(), Customer)

either one works

Kushal_Chawda

You can try something like this

LOAD *,AutoNumber(Month,Branch) as RANK Inline [

Branch, cutomer, Month, Rank, Sales

1, 1101, Jan 2015, 1, 2251

1, 1101, Feb 2015, 2, 2282

1, 1101, Mar 2015, 3, 2310

1, 1101, Apr 2015, 4, 2341

2, 1102, Jan 2015, 5, 2252

2, 1102, Feb 2015, 6, 2283

2 ,1102, Mar 2015, 7, 2311

2, 1102, Apr 2015, 8, 2342

3, 1103, Jan 2015, 9, 2253

3, 1103, Feb 2015, 10, 2284

3 ,1103, Mar 2015, 11, 2312

3 ,1103, Apr 2015, 12, 2343

4, 1104, Feb 2015, 14, 2285

4, 1104, Mar 2015, 15, 2313

4  ,1104, Apr 2015, 16, 2344

5 ,1105, Jan 2015, 17, 2255

5, 1105, Feb 2015, 18, 2286

5, 1105, Mar 2015, 19, 2314

5, 1105, Apr 2015, 20, 2345];

sasiparupudi1
Master III
Master III

I think you will have to convert your date format to achieve the desired results

Thread_169775.png

y:

LOAD *,Date(Date#(Month,'MMM YYYY'),'YYYYMM') as DateString Inline [

Branch, cutomer, Month, Rank, Sales

1, 1101, Jan 2015, 1, 2251

1, 1101, Feb 2015, 2, 2282

1, 1101, Mar 2015, 3, 2310

1, 1101, Apr 2015, 4, 2341

2, 1102, Jan 2015, 5, 2252

2, 1102, Feb 2015, 6, 2283

2 ,1102, Mar 2015, 7, 2311

2, 1102, Apr 2015, 8, 2342

3, 1103, Jan 2015, 9, 2253

3, 1103, Feb 2015, 10, 2284

3 ,1103, Mar 2015, 11, 2312

3 ,1103, Apr 2015, 12, 2343

4, 1104, Feb 2015, 14, 2285

4, 1104, Mar 2015, 15, 2313

4  ,1104, Apr 2015, 16, 2344

5 ,1105, Jan 2015, 17, 2255

5, 1105, Feb 2015, 18, 2286

5, 1105, Mar 2015, 19, 2314

5, 1105, Apr 2015, 20, 2345];

y1:

LOAD *,

AutoNumber(Month,Branch)  as [New Rank]

Resident y

Order By Branch, cutomer,DateString  ;

DROP Table y;

hope this helps

sasiparupudi1
Master III
Master III

Hi

Did you come alright with your problem?