Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Issue with Date

Hi All, I have an excel file containing attendance records of all employees in the format specified below.

   

Employee #NamesTeam NameDesignationWork status01-Jan-16 Fri02-Jan-16 Sat03-Jan-16 Sun04-Jan-16 Mon05-Jan-16 Tue06-Jan-16 Wed07-Jan-16 Thu
1PriyaITAnalystActivePPPPPPP
2PriyankaITAnalystActiveAAAAPPP
3MonikaFinanceAnalystActivePPPPPPP
4SarveshAdminAnalystActivePPPPPPP

And I want it to load it in below format

   

Employee #NamesTeam NameDesignationWork statusDateAtt_Value
1PriyaITAnalystActive01/01/2016P
2PriyankaITAnalystActive01/01/2016A
3MonikaFinanceAnalystActive01/01/2016P
4SarveshAdminAnalystActive01/01/2016P
1PriyaITAnalystActive02/01/2016P
2PriyankaITAnalystActive02/01/2016A
3MonikaFinanceAnalystActive02/01/2016P
4SarveshAdminAnalystActive02/01/2016P
1PriyaITAnalystActive03/01/2016P
2PriyankaITAnalystActive03/01/2016A
3MonikaFinanceAnalystActive03/01/2016P
4SarveshAdminAnalystActive03/01/2016P
1PriyaITAnalystActive04/01/2016P
2PriyankaITAnalystActive04/01/2016A
3MonikaFinanceAnalystActive04/01/2016P
4SarveshAdminAnalystActive04/01/2016P
1PriyaITAnalystActive05/01/2016P
2PriyankaITAnalystActive05/01/2016P
3MonikaFinanceAnalystActive05/01/2016P
4SarveshAdminAnalystActive05/01/2016P
1PriyaITAnalystActive06/01/2016P
2PriyankaITAnalystActive06/01/2016P
3MonikaFinanceAnalystActive06/01/2016P
4SarveshAdminAnalystActive06/01/2016P
1PriyaITAnalystActive07/01/2016P
2PriyankaITAnalystActive07/01/2016P
3MonikaFinanceAnalystActive07/01/2016P
4SarveshAdminAnalystActive07/01/2016

P

But the issue I am facing is with the date column. It is getting loaded in number format. I tried converting it into date format using date and date# function but couldn't achieve desired result.

I need your suggestions.

Thanks in advance

-Priyanka

20 Replies
Not applicable
Author

Hi Nagaraj,

When I am trying to load my data, its in this format

Attendence_Staging:
CrossTable([Report Date], Attendence_Value, 5)
LOAD  Num#([Employee #]) as [Employee No],
Names as [Employee Names],
[Team Name],
Designation,
[Work status],
[42370],
[42371],
[42372],
[42373],
[42374],
[42375],
[42376]

FROM $(vAttendence)Attendance tracker UK Ops.xlsx
(ooxml, embedded labels, table is [Jan - Dec 2016]) ;

Below is the screenshot of Report Date field

My QV date format is

SET DateFormat='DD-MM-YYYY';
SET TimestampFormat='DD-MM-YYYY hh:mm:ss[.fff]';

when I am using below script

Data:
Load *,
Date(Date#(Left([Report Date],7) & '2016','DD/MM/YYYY'),'DD-MM-YYYY') as Date
Resident Attendence_Staging;

I am getting Date field as '-'.

Please help

-Priyanka

tresesco
MVP
MVP

Or is it - you are trying to reply from your Inbox? Inbox doesn't have that option, try to open the thread in browser separately, you should get to attach.

Not applicable
Author

Tresesco- Yes I was trying to reply from inbox and that's the reason I was not getting attach option. Thanks for notifying it. I have attached sample excel file for your reference.

sasikanth
Master
Master

Try this

Date(Date#(Report_date,'DD-MMM-YYYY'),'DD-MMM-YYYY') as Req_Date

tamilarasu
Champion
Champion

Priyanka,

Try like below,

Tmp:

CrossTable([Report Date], Attendence_Value, 5)
LOAD  Num#([Employee #]) as [Employee No],
Names as [Employee Names],
[Team Name],
Designation,
[Work status],
[42370],
[42371],
[42372],
[42373],
[42374],
[42375],
[42376]

FROM $(vAttendence)Attendance tracker UK Ops.xlsx
(ooxml, embedded labels, table is [Jan - Dec 2016]) ;


Data:

Load *,

Date(Num#([Report Date])) as Date

Resident Attendence_Staging;


Drop Field [Report Date];

Drop Table Tmp;

tresesco
MVP
MVP

Temp:

CrossTable(Date, Att_Value, 5) LOAD [Employee #],

     Names,

     [Team Name],

     Designation,

     [Work status],

     [42370],

     [42371],

     [42372],

     [42373],

     [42374],

     [42375],

     [42376]

FROM

(ooxml, embedded labels, table is Sheet1);

Load

Names,
[Employee #],
[Team Name],

     Designation,

     [Work status],

     Date(PurgeChar(Date,'[]')) as Date

Resident Temp     ;

Drop Table Temp;

MarcoWedel

Hi,

in order to avoid hard coded date values in your script (e.g. for changing source files) you could try like:

QlikCommunity_Thread_206032_Pic1.JPG

QlikCommunity_Thread_206032_Pic2.JPG

table1:

CrossTable (DateTemp, Value, 6)

LOAD Evaluate([Employee #]) as Employee#, *

FROM [https://community.qlik.com/servlet/JiveServlet/download/977302-211779/Sample.xlsx] (ooxml, embedded labels, table is Sheet1);

Left Join (table1)

LOAD Distinct

    DateTemp,

    Date(Evaluate(DateTemp)) as Date

Resident table1;

DROP Fields [Employee #], DateTemp;

hope this helps

regards

Marco

Not applicable
Author

Hi Marco,

Thanks for your reply.

Can you please help me out in understanding this script. i.e. "LOAD Evaluate([Employee #]) as Employee#, *" why we have used Evaluate() in this script.

Thanks in advance

sujeetsingh
Master III
Master III

Use Crosstable Load

Anonymous
Not applicable
Author

By using the crosstable you can get the result