Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I guess this is simple, but I have to ask anyway.
Question 1:
In the attached spreadsheet you can see my Table_original. I have to loop through each ID to see if Duration>1. If Duration is 2 i have to add 1 line, if Duration is 3 I have to add 2 lines, and so on. The result should be as in Table_new.
Question 2:
I would like to create a variable IntSeries=(1,2,3,4,.....,100). What is the easiest way to create such a series?
Regards,
Torbjørn
You can use While loop here
Table:
LOAD ID,
Yr_reg + IterNo() - 1 as Yr_reg,
Duration,
Level,
Code
While IterNo() <= Duration;
LOAD * INLINE [
ID, Yr_reg, Duration, Level, Code
23, 2016, 1, 1, K1
23, 2017, 1, 2, K2
23, 2018, 1, 3, K3
23, 2019, 1, 4, K4
23, 2020, 1, 5, K5
25, 2016, 1, 1, S1
25, 2018, 1, 2, S2
25, 2019, 2, 3 and 4, S3
27, 2017, 1, 1, K1
27, 2019, 1, 3, K3
28, 2020, 3, "3, 4, and 5", R3
];
Best I have for you is to have a look in the Design Blog area of Community where we have a bunch of how-to examples, that is likely the best place to get ideas on how to go about things.
https://community.qlik.com/t5/Qlik-Design-Blog/bg-p/qlik-design-blog
Regards,
Brett
You can use While loop here
Table:
LOAD ID,
Yr_reg + IterNo() - 1 as Yr_reg,
Duration,
Level,
Code
While IterNo() <= Duration;
LOAD * INLINE [
ID, Yr_reg, Duration, Level, Code
23, 2016, 1, 1, K1
23, 2017, 1, 2, K2
23, 2018, 1, 3, K3
23, 2019, 1, 4, K4
23, 2020, 1, 5, K5
25, 2016, 1, 1, S1
25, 2018, 1, 2, S2
25, 2019, 2, 3 and 4, S3
27, 2017, 1, 1, K1
27, 2019, 1, 3, K3
28, 2020, 3, "3, 4, and 5", R3
];
Thank you very much, mr. Sunny!!