Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
fishing_weights
Contributor III
Contributor III

creating unique ID by numbering occurance of a value in script

I have a table with IDs. it can appear multiple times. Base on the date field it appears I want to engineer a unique ID in script, numbering off the original ID base on the first time it appears and +1 subsequently. Please see example of End result wanted in third column below.

thanks in 

ID DATE END RESULT WANTED
ABC 01JAN24 ABC 1
ABC 01FEB24 ABC 2
ABC 01DEC23 ABC 3
EFG 01JAN24 EFG 1
EFG 01FEB24 EFG 2
EFG 01DEC23 EFG 3
1 Solution

Accepted Solutions
Aditya_Chitale
Specialist
Specialist

OK got it.

Just change expression to:

ID & autonumber(ID&Date,ID) as END_RESULT

 

Regards,

Aditya

View solution in original post

5 Replies
Aditya_Chitale
Specialist
Specialist

Try this in Script:

ID & Autonumber(ID,DATE) as END_RESULT

 

Regards,

Aditya

fishing_weights
Contributor III
Contributor III
Author

thanks @Aditya_Chitale  but that just assign a sequential number down the whole table stopping and restarting at a certain number? which is not what i'm looking for....

Anil_Babu_Samineni

@fishing_weights Perhaps this?

LOAD ID,
DATE,
ID & ' ' & AutoNumber(DATE, IterNo()) as [END RESULT WANTED]
FROM
[https://community.qlik.com/t5/New-to-Qlik-Sense/creating-unique-ID-by-numbering-occurance-of-a-value...]
(html, utf8, UserAgent is 'Mozilla/5.0', embedded labels, table is @1);

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Aditya_Chitale
Specialist
Specialist

OK got it.

Just change expression to:

ID & autonumber(ID&Date,ID) as END_RESULT

 

Regards,

Aditya

fishing_weights
Contributor III
Contributor III
Author

Thanks Yes. this seems to be it. I was going to create some complex for loop with nested ifs.... saved the day