Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

alina_qlik
New 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

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

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

View solution in original post

4 Replies

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

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

View solution in original post

alina_qlik
New Contributor III

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

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

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

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

Support
Support

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

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 don't forget to use the "Accept as Solution" button on any posts that helped you resolve your problem or question.