Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
alina_qlik
Contributor III
Contributor III

How should i script to automatically create four quarter for every Year ?

Hello Experts ,

I have Year field , i want to create four quarters for each year . Being a new qliker I do not know , how to do it . 

Please help .

INPUT 

LOAD * INLINE [
YEAR
2015
2016
2017
2018
2019

];

OUTPUT

YEARQUARTER
2015Q1
2015Q2
2015Q3
2015Q4
2016Q1
2016Q2
2016Q3
2016Q4
2017Q1
2017Q2
2017Q3
2017Q4
2018Q1
2018Q2
2018Q3
2018Q4
2019Q1
2019Q2
2019Q3
2019Q4
1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi, Use the cross join to do that. Like shown below.

Data:

LOAD * INLINE [

YEAR

2015

2016

2017

2018

2019

];

Join (Data)
Load  * inline [

Qtr

Q1

Q2

Q3

Q4

];

 

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!

View solution in original post

4 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi, Use the cross join to do that. Like shown below.

Data:

LOAD * INLINE [

YEAR

2015

2016

2017

2018

2019

];

Join (Data)
Load  * inline [

Qtr

Q1

Q2

Q3

Q4

];

 

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
alina_qlik
Contributor III
Contributor III
Author

Thank You kaushik . Is there any other way without using join , i mean something like looping four times .
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

You can but this would be the easiest option I can think of. If you want to try for loop you can do that too.

Multiple for loop will be required.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Brett_Bleess
Former Employee
Former Employee

Just wanted to toss out a Design Blog post that might work as well:

https://community.qlik.com/t5/Qlik-Design-Blog/Using-the-Ceil-Function-to-Create-a-Quarter-Field/ba-...

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.