Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear all Qlik experts,
I am new to QlikSense and I am trying to create a unique ID for unique records in a new column or simply output the unique record under certain conditions
for records with same date and same brand name under the same QR Code will be only counted as one in new column - E
Sample:
thanks for helping once again!
Hi @JL1996
Try like below
Load *,
If(Previous(QRCode&'|'&BrandName&'|'&DateOfDelivery)<>
(QRCode&'|'&BrandName&'|'&DateOfDelivery),1,0) as UniqueID
resident yourdatasource
order by QRCode, BrandName, DateofDelivery;
Drop table yourdatasource;
Hope it helps;
hello there,
I am now using Qlik Sense which I dont think it will be applicable to QlikSense? This is suppose to be a little bit different from QlikView? thanks
Hi @JL1996
Try like below
T:
Load * Inline
[
QRCode,BrandName,Department,DateOfDelivery
AAA,Coca-Cola,Department A,2-Jan-20
AAA,Coca-Cola,Department A,2-Jan-20
AAA,Coca-Cola,Department A,2-Jan-20
AAA,Coca-Cola,Department A,2-Jan-20
AAA,Coca-Cola,Department A,3-Jan-20
BBB,Coca-Cola,Department A,5-Jan-20
CCC,Coca-Cola,Department A,8-Jan-20
AAA,Pepsi,Department G,9-Jan-20
AAA,Pepsi,Department G,10-Jan-20
AAA,Pepsi,Department G,11-Jan-20
AAA,Juice,Department G,12-Jan-20
AAA,Choco,Department G,13-Jan-20
];
Load *, if(Previous(QRCode&'|'&BrandName&'|'&Department)<>(QRCode&'|'&BrandName&'|'&Department), 1,0) as UniqueID
Resident T Order by QRCode, BrandName, Department, DateOfDelivery;
Drop Table T;
Output:
Please change inline table with ur source. And please try to provide sample excel sheet / table instead of image.
hello there, really appreciate for your help but can you kindly teach me how to do it in QlikSense? I dont see a "upload script button" in Qlik Sense. thanks
Hi @JL1996
If you are not able to see the highlighted option, Please check with Qlik Admin for your access.
thanks i am now able to find it, but there are two options which is "Main" & "Auto-generated section". Which one should I insert the script there? thanks
Hi @JL1996
Without see ur file, am not able to suggest. Could you please refer below link about data load editor.
https://www.youtube.com/watch?v=Pl9QKCifUTg&list=PLXwuEW0xHpwwc7ZWGQh_0ePEligqDp2hu&index=7
Hope it helps
hello there,
Please take a look at the sample file if you have time please.
btw is there an easier way to create the unique ID? lets say can we possibly use some formulas instead of typing the entire script while loading? thanks!
Hi @JL1996
I have some issues understanding your definition of unique id, as the records on row 2, 7, 8, 9, 12 and 13 have a Unique ID of 1, so the Unique ID is not that unique (that is my interpretation)
I will say the Unique ID of your records is this expression:
[QR Code] & '|' & [Brand Name] & '|' [Department]
Now, if you use the AutoNumber() function, you get an integer as Unique ID, like this:
AutoNumber([QR Code] & '|' & [Brand Name] & '|' [Department])
Now, it will be good to know what to do with those records having a "duplicated" Unique ID?
Hope this helps,