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: 
Not applicable

Dates generation(ADDING future dates)

Hi I have scenario,

In my database i  have data like below

       year                          Sales

200545
200654
200725
200856
200978
201031
201125
201226
201385
201457
201595
201664

I want add years more 20 like below

  

YearSalesGrowthRate
200545
200654
200725
200856
200978
201031
201125
201226
201385
201457
201595
201664
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033

2034

For adding those above years what i need to do

Please do the needful

Thanks

Thiru

6 Replies
Michiel_QV_Fan
Specialist
Specialist

concatenate

load *

inline [

     Year

2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033

2034];

florentina_doga
Partner - Creator III
Partner - Creator III

concatenate

load 2016+recno() as year autogenarate(20)

like this

aa:

load * inline [an

2016];

concatenate(aa)

load 2016+recno() as an autogenerate(20);

akpofureenughwu
Creator III
Creator III

concatenate

load *

inline [

     Year

2017
2018
2019
2020
2021
2022
2023
2024

2025

]

This should work

florentina_doga
Partner - Creator III
Partner - Creator III

or

aa:

load * inline [year, Sales

2005,    45

2006,    54

2007,    25

2008,    56

2009,    78

2010,    31

2011,    25

2012,    26

2013,    85

2014,    57

2015,    95

2016,    64

];

max_year:

load distinct max(year) as year_max resident aa;

let v_max_year=peek('year_max',0,'max_year');

drop table max_year;

concatenate(aa)

load $(v_max_year)+recno() as year autogenerate(20);

Not applicable
Author

Hi Thanks for your answer

If it is date stamp instead of year then this formula

let v_max_year=peek('year_max',0,'max_year'); will become

let v_max_year=addmonths(?


Please do the needful


i want to add months

Thanks

Thiru

florentina_doga
Partner - Creator III
Partner - Creator III

pls try this

aa:

load * inline [year, Sales

2005,    45

2006,    54

2007,    25

2008,    56

2009,    78

2010,    31

2011,    25

2012,    26

2013,    85

2014,    57

2015,    95

2016,    64

];

max_year:

load distinct max(year) as year_max resident aa;

let v_max_year=peek('year_max',0,'max_year');

drop table max_year;

concatenate(aa)

load $(v_max_year)+recno() as year autogenerate(20);

left join(aa)

load * inline [month

1

2

3

4

5

6

7

8

9

10

11

12];

NoConcatenate

bb:

load *,

makedate(year,month,1) as date

resident aa;

drop table aa;