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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
nicolai_moller
Contributor
Contributor

Create sequential number

Hi

I want to create a field that makes a sequential number.

My initial table:

PersonCaseFileDate
1A1101-01-2016
1A1201-01-2016
1B2202-02-2015
2C3301-01-2017
3D4402-02-2018
4E5505-05-2017
4F5604-04-2017
4A1101-01-2016

The table below is what I'm trying to achieve.

PersonCaseFileDateSeq.noRemarks
1A1101-01-20161The sequence number starts at 1 at the newest date on this person (Person 1)
1A1201-01-20161The sequence number stays at 1 as the Case is still the same
1B2202-02-20152The sequence number increases as the Case is different
2C3301-01-20171New person, new case. Sequence restarts at 1
3D4402-02-20181New person, new case. Sequence restarts at 1
4E5505-05-20171New person, new case. Sequence restarts at 1
4F5604-04-20172Same person as above, but new case. Sequence number increases
4A1101-01-20163Same person as above, but new case. Sequence number increases. The case is the same as Person 1
1 Solution

Accepted Solutions
sunny_talwar

May be this

AutoNumber(Case, Person) as SeqNo

View solution in original post

3 Replies
sunny_talwar

May be this

AutoNumber(Case, Person) as SeqNo

Qrishna
Master
Master

PSA.

1.PNG

MarcoWedel

Hi,

another solution could be:

QlikCommunity_Thread_299407_Pic1.JPG

table1:

LOAD *,

    If(Person=Peek(Person),Peek(SeqNo)-(Case<>Peek(Case)),1) as SeqNo

FROM [https://community.qlik.com/thread/299407] (html, codepage is 1252, embedded labels, table is @1);

hope this helps

regards

Marco