Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Can any one please help on QlikView Date Formating

Hi friends I have a Field in my source with name Last Update having Source Load Time stamp.

201503

LastUpdate
201503

Here From 'YYYYMM' need to get Year,Month,Quarter

1)Need to get Year from Last Update field and after need to get month in it(here how to use Right or Left(LastUpdate)

2)Need to get Quarter depend on Month field in If else statement

2 Replies
JonnyPoole
Employee
Employee

Key is to recognize the incoming data as a date field of the format YYYYMM using the date#() function.  Then you can reference that in Year, Month, and quarter functions;

Load

     Year(LastUpdate) as Year,

     Month(LastUpdate) as Month,

     'Q' & ceil( Month(LastUpdate) /3) as Quarter;

Load

     date#(LastUpdate,'YYYYMM') as LastUpdate

from <>

Not applicable
Author

for year you can do

Left(LastUpdate, len(LastUpdate)-2)

For Qt try:

If( Right(LastUpdate, Len(LastUpdate)-4) <=3 ,1,

If(Right(LastUpdate, Len(LastUpdate)-4) > 3 and Right(LastUpdate, Len(LastUpdate)-4) <= 6, 2,

if(Right(LastUpdate, Len(LastUpdate)-4) > 6 and Right(LastUpdate, Len(LastUpdate)-4) <= 9, 3, 4)))

Regards

Rahul