Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
pranaview
Creator III
Creator III

how to assign an incremental ID for duplicate values

Hi Guys,

Requirement: So, I am looking for a way to uniquely identify a column which has duplicate values. There is no other unique ID column in the table which i can use to create a composite key. I was thinking if I can number the duplicate values then I can I have a unique ID.

for example, something like this:

ID                  AutoIncrementNo.    or    AutoIncrementNo.

12455                    -                                                      -       

12567                   1                                                      -

12567                   2                                                      1

12567                   3                                                      2

12768                    -                                                      -

12789                    1                                                     -

12789                    2                                                     -

 

I hope i have the requirement clear enough, please let me know if there's any way i can implement this.

Thanks!

Pranav

Labels (3)
1 Solution

Accepted Solutions
Arthur_Fong
Partner - Specialist III
Partner - Specialist III

Try this as your duplicate counts:

if(RowNo()=1,1,if(peek(ID)=ID,peek(Num1)+1,1)) as Num1

View solution in original post

2 Replies
Arthur_Fong
Partner - Specialist III
Partner - Specialist III

Try this as your duplicate counts:

if(RowNo()=1,1,if(peek(ID)=ID,peek(Num1)+1,1)) as Num1

pranaview
Creator III
Creator III
Author

Thanks Arthur!

This is what I was looking for.