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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
rsdhavle
Creator III
Creator III

Adding unique row number

I have one column in which i am arranging data in a descending order. I want to give a unique row number for each row like 1,2,3,4...

but suppose the data is same in two rows lets say value is 30 and again 30 in the second row it should give same number to both the rows like 1,1 or 2,2

What would be the best function to use and what would be the expression. Is it Rank function that should be userd?


1 Solution

Accepted Solutions
Anonymous
Not applicable


Please refer to the attached file ,

This resolves your question.


s_no in the sample is your output field.

Regards

Nitin

View solution in original post

5 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

You could add a counter field in the script and use that:

Load MyField, autonumber(MyField) as Counter

From ...

You could also try using the fieldindex function as an expression: fieldindex('MyField', MyField)


talk is cheap, supply exceeds demand
Anonymous
Not applicable


Please refer to the attached file ,

This resolves your question.


s_no in the sample is your output field.

Regards

Nitin

jagan
Partner - Champion III
Partner - Champion III

Hi Rohan,

Use RowNo() in load script this will give 1,2,3,4,5 etc.

Example:

Data:

LOAD

*,

RowNo() AS UniqueNumber

FROM DataSource;

Regards,

Jagan.

Not applicable

If the values are not in sorted order then what will be the procedure.

Not applicable

Hi rohan,

Dev03:

LOAD * Inline        

[

Fild,Value

A,1

B,2

C,3

D,3

E,4

F,5

G,5

H,6

I,7

J,7

K,8

];

LOAD RowNo() AS UID,* Resident  Dev03;