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: 
alec1982
Specialist II
Specialist II

Add value from the first raw to all raws

Hi guys,

I have a table as follow

ID     Value

1          100

2            -

3            -

How can i create a new field to have the same value(100) for all IDs and my table will look like

ID     Value       New value

1          100          100

2            -             100

3            -             100

Thxs,

Alec

1 Solution

Accepted Solutions
MayilVahanan

Hi

Its working for me.. Check file

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

4 Replies
MayilVahanan

Hi

try like this

Load ID, Value, If(Isnull(Value),Peek('NewValue'), Value) AS NewValue From tablename;

Edit:

or

Load ID, Value, If(Len(Trim(Value))=0,Peek('NewValue'), Value) AS NewValue;

Load * Inline

[

ID , Value

1, 100

2,

3

];

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
alec1982
Specialist II
Specialist II
Author

hi,

It is not working.. I am getting an error..

Syntax error, missing/misplaced ..

MayilVahanan

Hi

Its working for me.. Check file

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
albertovarela
Partner - Specialist
Partner - Specialist

Hello, For this specific case try:

DataTemp:

LOAD * INLINE [

    ID, Value

    1, 100

    2, -

    3, -

];

Data:

LOAD

  ID

  ,Value

  ,if(RowNo()=1 ,Value,peek(Value,0)) as NewValue 

Resident DataTemp

;

Drop Table DataTemp

;