5 Replies Latest reply: Jun 7, 2017 8:22 AM by Christopher Ellis RSS

    QlikSense Date Format

    Christopher Ellis

      Hi,

       

      I am trying to format a date from a CSV file that looks like this 15 October 2015 using function like so that it is recognised as a date ;

       

                Date#(Field,'DD MMMM YYYY') As FormatedDate        //This also makes the date right aligned

       

      and then use the function in QlikSence 3.2 to create calendar measures and I keep getting the following message;

       

                No date field detected. Load data containing a date field in the Data manager and try creating a calendar measure again.

       

      Any advise appreciated.

       

      Thanks

       

      Chris

        • Re: QlikSense Date Format
          Tomasz Truszkowski

          Try: Date(Date#(Field,'DD MMMM YYYY'))

          • Re: QlikSense Date Format
            Sunny Talwar

            May be this

             

            Date#(PurgeChar(Field, ' '),'DDMMMMYYYY') as FormatedDate

            • Re: QlikSense Date Format
              MARCO HADIYANTO

              Hi Christopher,

               

              You want to create calendar measurement? So you should generate master calendar, here's script for master calendar :

               

              [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 [OrderDate] USING [autoCalendar] ;

               

               

              Change [OrderDate] to your date field. in your case change [OrderDate] with FormatedDate

               

              Hope it helps

              Regards,

              Marco