Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

create date using quarter and year

can we create date from year and quarter field

1 Solution

Accepted Solutions
jagan
Luminary Alumni
Luminary Alumni

Hi Swetha,

Try this script below

LOAD *,

MakeDate(Year, Quarter*3) AS Date,

SubField(Quarter*3 & '/' & (Quarter*3 - 1) & '/' & (Quarter*3 - 2), '/') AS Month

INLINE [

    Year, Quarter

    2015, 1

    2015, 2

    2015, 3

    2015, 4

];

Regards,

Jagan.

View solution in original post

18 Replies
vivek_niti
Partner - Creator
Partner - Creator

Please share sample data.

arulsettu
Master III
Master III

try like this

makedate(year,quarter) as date

vivek_niti
Partner - Creator
Partner - Creator

The makedate function only accepts year, month and day as parameters.

avinashelite

Hi Shweta,

Build a custom calendar and like the Quarter and year ...that the easiest way to generate dates   

Not applicable
Author

how?


Not applicable
Author

Derive Month from Quarter And use makedate function with year and derived month,

If quarter = Q1, Month = Jan or Feb Or Mar Like this,

and Makedate(year, Month) As Date

Faisal

jonathandienst
Partner - Champion III
Partner - Champion III

Assuming quarter is a number between 1 and 4:

=MakeDate(year, (quarter - 1) * 3 + 1)

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

pfa

vivek_niti
Partner - Creator
Partner - Creator

Try this code

tab1:

LOAD * INLINE [

    Year, Quarter

    2015, 1

    2015, 2

    2015, 3

    2015, 4

];

tab2:

LOAD *,

  Date(Makedate(Year,Month),'DD-MM-YYYY') AS Date;

LOAD Year,

  Quarter,

  Pick(Match(Quarter,1,2,3,4),1,4,6,10) AS Month

RESIDENT tab1;

DROP TABLE tab1;