Skip to main content
Announcements
Get Ready. A New Qlik Learning Experience is Coming February 17! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to extract the year, month and date from a date function in order to make a graph.

Hello everyone,

I've just sarted using qlikview, I think my question is really basic yet I cannot manage to do it. I have loaded my datas on Qlikview,

one of the field I have in my data is named pdate, its format is dd/mm/yyyy. I want to extract the year, month and day from this field. I need it to make basic bar charts where the variables are year and amount.

Thank you in advance for your answers.

Djalal

11 Replies
cheburashka
Creator III
Creator III

Hello Djalal,

Here is the full script.

Données:

LOAD action_id,

     action_group,

     dropdate,

     segmentdescription,

     ind_id,

     cl_18,

     amount,

     OP, 

     Date(Date(pdate, 'DD/MM/YYYY')) As pdate,

  Year(Date(pdate, 'DD/MM/YYYY')) As pdateYear,

  Month(Date(pdate, 'DD/MM/YYYY')) As pdateMonth,

  Day(Date(pdate, 'DD/MM/YYYY')) As pdateDay,

     zipcode,

     city,

     language,

     sexcode,

     country,

     ind_status_flag,

     address_id,

     street_name,

     street_remainder,

     groupdescription,

     firstgift,

     lastgift

FROM

Données_DSC.xlsx

(ooxml, embedded labels, table is Feuil1);

,Koen

kumarravi
Contributor III
Contributor III

Hi,
You can extract Date, Year, Month and Day using following expression:

Table_name:

Load 

  Date(Date(col_name, 'DD/MM/YYYY')) as Date,

  Year(Date(col_name, 'DD/MM/YYYY')) as Year,

  Month(Date(col_name, 'DD/MM/YYYY')) as Month,

  Day(Date(col_name, 'DD/MM/YYYY')) As Day

I hope this helped🙌

Happy Learning 🙂 !