Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all.
I'm trying to convert a field with the follow format date:
01-sep-2017 (08:24:12)
To a field that I can use as date field to filter by date, month, quarter, etc.. on qlik sense
Following some post I try the follow:
Date(Date#([APERTURA],'dd-M-YY (hh:mm:ss)'), 'D/M/YYYY') as [Data Apertura],
And creating a calendar at the end of the load script:
[autoCalendar]:
DECLARE FIELD DEFINITION Tagged ('$date')
FIELDS
Dual(Year($1), YearStart($1)) AS [Year] Tagged ('$axis', '$year'),
Dual('Q'&Num(Ceil(Num(Month($1))/3)),Num(Ceil(NUM(Month($1))/3),00)) AS [Quarter] Tagged ('$quarter', '$cyclic'),
Dual(Year($1)&'-Q'&Num(Ceil(Num(Month($1))/3)),QuarterStart($1)) AS [YearQuarter] Tagged ('$yearquarter', '$qualified'),
Dual('Q'&Num(Ceil(Num(Month($1))/3)),QuarterStart($1)) AS [_YearQuarter] Tagged ('$yearquarter', '$hidden', '$simplified'),
Month($1) AS [Month] Tagged ('$month', '$cyclic'),
Dual(Year($1)&'-'&Month($1), monthstart($1)) AS [YearMonth] Tagged ('$axis', '$yearmonth', '$qualified'),
Dual(Month($1), monthstart($1)) AS [_YearMonth] Tagged ('$axis', '$yearmonth', '$simplified', '$hidden'),
Dual('W'&Num(Week($1),00), Num(Week($1),00)) AS [Week] Tagged ('$weeknumber', '$cyclic'),
Date(Floor($1)) AS [Date] Tagged ('$axis', '$date', '$qualified'),
Date(Floor($1), 'D') AS [_Date] Tagged ('$axis', '$date', '$hidden', '$simplified'),
If (DayNumberOfYear($1) <= DayNumberOfYear(Today()), 1, 0) AS [InYTD] ,
Year(Today())-Year($1) AS [YearsAgo] ,
If (DayNumberOfQuarter($1) <= DayNumberOfQuarter(Today()),1,0) AS [InQTD] ,
4*Year(Today())+Ceil(Month(Today())/3)-4*Year($1)-Ceil(Month($1)/3) AS [QuartersAgo] ,
Ceil(Month(Today())/3)-Ceil(Month($1)/3) AS [QuarterRelNo] ,
If(Day($1)<=Day(Today()),1,0) AS [InMTD] ,
12*Year(Today())+Month(Today())-12*Year($1)-Month($1) AS [MonthsAgo] ,
Month(Today())-Month($1) AS [MonthRelNo] ,
If(WeekDay($1)<=WeekDay(Today()),1,0) AS [InWTD] ,
(WeekStart(Today())-WeekStart($1))/7 AS [WeeksAgo] ,
Week(Today())-Week($1) AS [WeekRelNo] ;
DERIVE FIELDS FROM FIELDS [Data Apertura] USING [autoCalendar] ;
But this not work, when I try to get month of the date Data Apertura.autoCalendar.Month not work.
Any help?
Try this
TimeStamp(Date#([APERTURA], 'DD-MMM-YYY (hh:mm:ss)')) as TimeStamp,
Date(Floor(Date#([APERTURA], 'DD-MMM-YYY (hh:mm:ss)'))) as [Data Apertura],
Not work.
When I select the dimension month show a empty field (value -).
Would you be able to share a sample to look at this?
Hi.
How I can add a qvf here? I don't find the option. If you send me your email i can send you an example.
Thx
Timestamp(Timestamp#(subfield([APERTURA],' ',1) &' '& TextBetween(subfield([APERTURA],' ',2),'(',')'),'DD-MMM-YYYY hh:mm:ss'))
Look here
Sorry I don't have the option to attach document. You can get the an example here.