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: 
omyahamburg
Creator II
Creator II

generate in script 12 monthly values from a single year value

Dear All

I have a table with a lots of Years and a values.

Eg.

Year     value

2012     1200

...

I would like to generate within my script a table which

splits these values into the months:

Eg:

YearMonth     value

2012-01100
2012-02100
2012-03100
2012-04100
2012-05100
2012-06100
2012-07100
2012-08100
2012-09100
2012-10100
2012-11100
2012-12100

Can anyone tell me how to generate this ?

I hope an easy task for the experts, but I am still beginner

and appreciate your help.

Cheers

Joerg

1 Solution

Accepted Solutions
Not applicable

Hi,

Please find the atatched doc.

Regards,

Yaseen

View solution in original post

11 Replies
manideep78
Partner - Specialist
Partner - Specialist

Hi

give us an idea how you want to split your values into months? What values field actually consists of?

omyahamburg
Creator II
Creator II
Author

Any found Year value must be divided by 12 and the YearMonth must be created from 01-12 for the corresponding Year.

manideep78
Partner - Specialist
Partner - Specialist

Any found year value must be divided by 12. Thats fine.

But how to get 01-12? what does it exactly mean?

Provide some sample data.

Your data has only year and values. so how you want to generate YearMonth?

omyahamburg
Creator II
Creator II
Author

As I wrote, I have a Year value eg. 1200

This value needs to divided by 12 to get eg. 100 each and to each of the new value the month from January=01 till December=12 should be created.

julian_rodriguez
Partner - Specialist
Partner - Specialist

Hello Joerg

This article solves the first question: populate the table with the dates between the first and the last:

http://community.qlik.com/blogs/qlikviewdesignblog/2013/02/05/populating-a-sparsely-populated-field

With this table, then you may use RangeAvg() and Peek() functions to make the average.

But first of all, populate your data.

Regards

Not applicable

Hi,

Please find the atatched doc.

Regards,

Yaseen

omyahamburg
Creator II
Creator II
Author

Hi Julian

This looks good. I will go through this example for my case.

Thx a lot and have a good weekend.

jagannalla
Partner - Specialist III
Partner - Specialist III

Hello,

You can try this, it is very simple and faster.

Temp:

LOAD * INLINE [

    Year, Value

    2012, 1200

    2013, 1200

];

CalenderVal:

LOAD Date(MakeDate(Year, IterNo()),'YYYY-MM') as YrMonth,(Value/12) as Val

Resident Temp While IterNo()<=12;

Hope it helps you

Cheers!!

Jagan

omyahamburg
Creator II
Creator II
Author

Hi Yaseen

I never thought that it can be so easy. You made my day.

But as I am always eager to learn I'll also go through the exercise from Julian.

Thx a lot and have a good weekend.

Joerg