Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Date format

Hi all!

I've tried to make a simple sales/year chart but I'm struggling with the dates...

I get my data from an odbc and the date format is YYYYMMDD (e.g 20120213). When I try to change the number format settings to dates the values are just nonsense...

What should I do in order to get the chart so that it would show sales/years then months and days?

Cheers!

1 Solution

Accepted Solutions
jagan
Luminary Alumni
Luminary Alumni

Hi,

Use the following example of Load statement

LOAD

     Date,

     Year(Date) AS Year,

     Month(Date) AS Month,

     Day(Date) AS Day

     '

     '

     ';

LOAD

     Date(Date#(DateField, 'YYYYMMDD')) AS Date

'

'

'

'

FROM ABC.txt;    

In the above script you can arrive the Year, Month, Day and Date in valid format.  By using Month, Year and Day dimensions you can create the charts.

Regards,

Jagan.

View solution in original post

10 Replies
jagan
Luminary Alumni
Luminary Alumni

Hi,

Use the following example of Load statement

LOAD

     Date,

     Year(Date) AS Year,

     Month(Date) AS Month,

     Day(Date) AS Day

     '

     '

     ';

LOAD

     Date(Date#(DateField, 'YYYYMMDD')) AS Date

'

'

'

'

FROM ABC.txt;    

In the above script you can arrive the Year, Month, Day and Date in valid format.  By using Month, Year and Day dimensions you can create the charts.

Regards,

Jagan.

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Use expression like this

     Num(Date#(YourDateField,'YYYYMMDD'))

Hope it helps

Celambarasan

Not applicable
Author

Hey Jagan!

Thanks for the quick reply!

I did not quite get this part

  

LOAD

     Date(Date#(DateField, 'YYYYMMDD')) AS Date

In my script I have

          ODBC connect to...

          SQL select......

          .

          .

          From...

To which part should I put that? I got a few errors when I added to My date field's name is 'lstupddte'

          Date(Date#(DateField, 'YYYYMMDD')) AS Date

Thanks and regards!

Antti

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     You can use like,

     Load

           *,

           Date(Date#(DateField, 'YYYYMMDD')) AS Date;

      SQL select......

          .

          .

      From...

Instead of  * you can use the field names from the SQL Select query.

Hope it helps

Celambarasan

jagan
Luminary Alumni
Luminary Alumni

Hi,

Date and Date# are qlikview functions.  It should not be used in SQL queries.  So first load the data from SQL and then using Preceding Load change the date format and arrive the required columns.  The example of preceding load is

Load

   *,

  Date(Date#(DateField, 'YYYYMMDD')) AS Date;

SQL select......

     DateField,

        .

       .

From TableName;

Regards,

Jagan.

Not applicable
Author

Hi,

Thanks a lot! Now I got the date format in order!

Not applicable
Author

Hi,

One more question relating to this...

Now that I have the date format set up, how can I do the sales/year so that I can drill down to months and days?

Thanks a lot in advance!

Anonymous
Not applicable
Author

Hi

          You can achieve your solution using the pivot table .

          I attached one example qv file please refer.

Anonymous
Not applicable
Author

Hi

        Also  You can use the drill down option from chart to achieve your solution.

        See the attached file it will helpful

Regards

Ashok