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: 
Anonymous
Not applicable

Creating a unique ID

I have an ID field in my qlikview document that is considered personal/sensitive data that cannot be shown to other users. I am creating a report that needs to be grouped by this field, so i want to create a secondary ID field, based on the unique values in the original ID field, so that this new ID can be used on the report and sent to users.

Any ideas? I tried autonumber(Orginial ID) and it froze my entire qlikview instance.

1 Solution

Accepted Solutions
sunny_talwar

How much data do you have? Another approach would be to use Peek/Previous to create a unique ID

Table:

LOAD [Original ID],

           ....

FROM ...;

FinalTable:

LOAD *,

           If([Original ID] = Previous([Original ID]), Peek('UniqueID'), RangeSum(Peek('UniqueID'), 1)) as UniqueID

Resident Table

Order By [Original ID];


DROP Table Table;

View solution in original post

5 Replies
sunny_talwar

How much data do you have? Another approach would be to use Peek/Previous to create a unique ID

Table:

LOAD [Original ID],

           ....

FROM ...;

FinalTable:

LOAD *,

           If([Original ID] = Previous([Original ID]), Peek('UniqueID'), RangeSum(Peek('UniqueID'), 1)) as UniqueID

Resident Table

Order By [Original ID];


DROP Table Table;

Not applicable
Author

Hi,

If the above does not work... how about using RowNo() when loading the data to give the row a Unique ID...

if needed, you can import the distinct version of your ID with the row number and then use table joins to move the Row Number ID around to other tables in QlikView

JOIN (Data)

LOAD

  *

RESIDENT UniqueIDs;

and then drop the field\tables once finished.

This probably means the Row ID to your UNID changes with every data load

Anonymous
Not applicable
Author

This worked! Thank you so much. One last question, will these IDs change every time we reload the document?

sunny_talwar

They might change based on different the order of [Original ID]

Not applicable
Author

Hi

Directory;

Final:

LOAD Id,

     Amount

FROM

Table;

Final_Data:

LOAD *,

      If([Id]=Previous([Id]),Peek('UniqueID'),RangeSum(Peek('UniqueID'),1)) as UniqueID

      Resident Final