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

Announcements
Check out our latest virtual session where BARC Fellow, Doug Laney, highlighted the opportunities data monetization can offer enterprises. Watch here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Need to fill a new column based on row data

Hi All,

I need to convert the table 01 to table 02. Pease let me know if you have any suggestions. I tried to use FOR loop but failed. Would really appreciate if anyone could assist me asap. Thanks, Hansika

table01.pngtable02.png

1 Solution

Accepted Solutions
vishsaggi
Champion III
Champion III

Try this?

LOAD Time,

     Resource,

     RowNo() AS RowNum,

     IF(Len(Period) = 0, Peek('Period'), Period) AS Period;

LOAD Time,

     IF(Subfield(Resource,':',1) = 'Period', '', Resource) AS Resource,

     RowNo() AS RowNum,

     IF(Len(Time)>0, '', Resource)  AS Period;

LOAD * INLINE [

Resource, Time

Period:7/30/2016-8/05/2016,

A,8

B,8

Period:9/30/2016-11/05/2016

A,8

B,8

C,8

];

View solution in original post

1 Reply
vishsaggi
Champion III
Champion III

Try this?

LOAD Time,

     Resource,

     RowNo() AS RowNum,

     IF(Len(Period) = 0, Peek('Period'), Period) AS Period;

LOAD Time,

     IF(Subfield(Resource,':',1) = 'Period', '', Resource) AS Resource,

     RowNo() AS RowNum,

     IF(Len(Time)>0, '', Resource)  AS Period;

LOAD * INLINE [

Resource, Time

Period:7/30/2016-8/05/2016,

A,8

B,8

Period:9/30/2016-11/05/2016

A,8

B,8

C,8

];