Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to generate sequence number per change in a given field?

Hi all,

I have this problem.

I have a logical table in my application.

I want to generate Line_Number(seqNo) for each distinct value of Field "Doc_No".

So for example I want the Line_Number be generated like this:

Doc_NoLine_Number

K1000

10000
K100020000
K100030000

K1001

10000
K100120000
K100210000
K100220000
K100230000
K100240000
K100250000

Thanks in advance,

Kari

1 Solution

Accepted Solutions
lironbaram
Partner - Master III
Partner - Master III

hi

check the attach file

hope it helps you

View solution in original post

5 Replies
lironbaram
Partner - Master III
Partner - Master III

hi

check the attach file

hope it helps you

Not applicable
Author

Thanks,

works excellently.

Not applicable
Author

Thanks! Was looking for this too!

Not applicable
Author

Liron, I am unable to open the TEST.qvw file since I am running personal edition and I am out of recovery keys.

Anyhow hoping that you could post and explain your script here.

Any assistance would be appriciated

Thanks!

MayilVahanan

Hi

Try like this

Load *, if(Previous(Doc_No)=Doc_No,numsum(peek('Line_Number'),1),1) As Line_Number from tableName;

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.