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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
kylealpaugh
Contributor
Contributor

Add Month Column

I have a table with year targets I need to make them by Period 1-12

The table currently has 3 fields customer material and target 

Customer Material Target 

1A                     BBX          120

1B                     BVF           240

 

I want to be able to add a column for period and divide each of the targets by 12to look like 

Customer  Material   Target Period

1A                      BBX         10          1

1A                       BBX        10           2

 

Is this possible to do in the script I cant find a way to do it 

 

1 Solution

Accepted Solutions
QFabian
MVP
MVP

Hi @kylealpaugh , very fun script, please check if it works for you :

A:
LOAD * INLINE [
Customer, Material, Target
1A, BBX, 120
1B , BVF,240
];


left join
LOAD * INLINE [
Month
1
2
3
4
5
6
7
8
9
10
11
12
];

 

B:
Load
Customer,
Material,
Target,
Target / 12 as TargetMonth,
Month


Resident A;
drop table A;

Greetings!! Fabián Quezada (QFabian)
did it work for you? give like and mark the solution as accepted.

View solution in original post

2 Replies
QFabian
MVP
MVP

Hi @kylealpaugh , very fun script, please check if it works for you :

A:
LOAD * INLINE [
Customer, Material, Target
1A, BBX, 120
1B , BVF,240
];


left join
LOAD * INLINE [
Month
1
2
3
4
5
6
7
8
9
10
11
12
];

 

B:
Load
Customer,
Material,
Target,
Target / 12 as TargetMonth,
Month


Resident A;
drop table A;

Greetings!! Fabián Quezada (QFabian)
did it work for you? give like and mark the solution as accepted.
kylealpaugh
Contributor
Contributor
Author

Thanks it worked