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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Increment a number field

Hi guys,

I have a field called unique_id. 

Capture1.PNG

I would like to add one to this column per row like this

153480

153481

153482

153483

153484

and so on...

Is this possible in an expression? Or another way?

Thanks

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Thanks for all your help guys.  I have figured out a way to do this.

In my load script I created an extra field

RowNo() as 'row_num'

I then created an expression which adds the unique_id to the row_num field

=unique_id + row_num

I wouldn't have figured this out without your help so thank you very much again

View solution in original post

9 Replies
sunny_talwar

May be:

RangeSum(unique_id, RowNo())

Kushal_Chawda

Create a straight table

Dimension - Unique_id

Expression - concat( bin_code,',')

swuehl
MVP
MVP

RangeSum(unique_id, RowNo()-1)

sunny_talwar

Thanks you for fixing the expression

Anonymous
Not applicable
Author

Thanks for your help so far guys.  None of these has worked so please keep going!

sunny_talwar

Would you be able to share a sample?

Mark_Little
Luminary
Luminary

HI,

Could address in script?

IF( Rowno()= 1, Unique_id, Previous(Unique_id) +1) as Unique_id


Of


IF( Rowno()= 1, Unique_id, 

     IF( Unique_id =Previous(Unique_id), Previous(Unique_id)+1) as Unique_id    

Mark

maxgro
MVP
MVP

unique_id + RangeSum(Above(sum(1), 0, rowno()))-1

Anonymous
Not applicable
Author

Thanks for all your help guys.  I have figured out a way to do this.

In my load script I created an extra field

RowNo() as 'row_num'

I then created an expression which adds the unique_id to the row_num field

=unique_id + row_num

I wouldn't have figured this out without your help so thank you very much again