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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
akpofureenughwu
Creator III
Creator III

Create Quarter from Month Field

Good morning everyone,

Usually I do create a quarter field from my date field that comes in this form... DD/MM/YYYY.

But I has a unique data fields that looks like this

YearMonth`Figures
2012January56
2012February78
2012March90

How do I create a quarter field from the above data set?

Thank you for your anticapted response,

Regards

13 Replies
akpofureenughwu
Creator III
Creator III
Author

Thanks Sunny

Still having errors. See attached 

sunny_talwar

Missed a comma

LIB CONNECT TO ' Planning';

LOAD *,

      'Q' & Ceil(Month(Date)/3) as Quarter,

      Date;

LOAD *,

    Date(Date#(Year&Month, 'YYYYMMMM')) as Date;

LOAD if(Len(Trim("Year")) = 0, Peek ("Year"), "Year") as "Year",

    if(Len(Trim("Month")) = 0, Peek ("Month"), "Month") as "Month",

    "Field",

    Figures;

SQL SELECT "Year",

    "Month",

    "Field",

    Figures

FROM " Planning".dbo.Planning;

akpofureenughwu
Creator III
Creator III
Author

Hello Sunny, Thank you sir,

I had to change a line so it can work...

LOAD *,

if( Isnum(Date), 'Q')& Ceil(Month(Date)/3) as Quarter;

LOAD *,

    

    Date(Date#(Year&Month, 'YYYYMMMM')) as Date;

LOAD if(Len(Trim("Year")) = 0, Peek ("Year"), "Year") as "Year",

    if(Len(Trim("Month")) = 0, Peek ("Month"), "Month") as "Month",

    "Field",

    Figures;

SQL SELECT "Year",

    "Month",

    "Field",

    Figures

FROM Planning".dbo.Planning;

And it worked..

Thanks everyone

akpofureenughwu
Creator III
Creator III
Author

Thank you Sir