Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
omkar_2611
Partner - Contributor II
Partner - Contributor II

How to create multiple rows based on the values between two columns?

Hello,

I am new to Qlik Sense & I am trying to implement a logic into qlik editor but I am stuck at a point. How can I add multiple rows based on the calculation of values of 2 columns?

I have a following table:

Table_A:

ID Items From Till Check
501 8 111 120 2
502 10 781 792 2

 

I want to create a new column which adds the rows value between 'till' and 'from' columns.

e.g. (120+1) - 111 = 10,

10 values = 111,112,113,...,119,120

Output_Table:

ID Value
501 111
501 112
501 113
501 114
501 115
501 116
501 117
501 118
501 119
501 120
502 781
502 782
502 783
502 ...
502 792

 

Labels (2)
1 Solution

Accepted Solutions
omkar_2611
Partner - Contributor II
Partner - Contributor II
Author

Temp_Table:
LOAD * inline [
ID, Items, From, Till, Check
501, 8, 111, 120, 2
502, 10, 781, 792, 2
];

Table:
LOAD *,
From + IterNo() - 1 as Value
Resident Temp_Table
While Till >= From + IterNo() - 1;

Drop Table Temp_Table;

View solution in original post

1 Reply
omkar_2611
Partner - Contributor II
Partner - Contributor II
Author

Temp_Table:
LOAD * inline [
ID, Items, From, Till, Check
501, 8, 111, 120, 2
502, 10, 781, 792, 2
];

Table:
LOAD *,
From + IterNo() - 1 as Value
Resident Temp_Table
While Till >= From + IterNo() - 1;

Drop Table Temp_Table;