Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
udaya_kumar
Specialist
Specialist

Load date from excel and do cross join in qlikview

Hi,

I have attached the sample data excel file and an image.

I want to load that excel file into qlikview and do crossjoin to load the date (Month) values as rows instead of columns.

When i try to load the excel file into QlikView, the date values shows like as attached in the image file.

How to load the date values properly into qlikview and do cross join in the script?

P.S : The dates will be getting added every month when new data appears.

1 Solution

Accepted Solutions
maxgro
MVP
MVP

T:

CrossTable(Month, Data, 3)

LOAD

  *

FROM

Data.xlsx

(ooxml, embedded labels, table is Sheet1);

F:

NoConcatenate LOAD

  ID,

    Name,

    Department,

    date(trim(Month),'MMM-YY') as Month,

    Data

Resident T;

DROP Table T;   

1.png

View solution in original post

6 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Like this:

MyTable:

CrossTable(Date,Value,3)

LOAD * FROM

[Data.xlsx]

(ooxml, embedded labels, table is Sheet1);

The Date field contains numbers, which is what dates really are. You can format these values in charts and expressions using the Date() function: Date(Date, 'DD/MM/YYYY')

If you want to do it in the script then you need an additional load:

Result:

NoConcatenate

LOAD ID, Name, Department, Date(Date, 'DD/MM/YYYY')  as Date

Resident MyTable;

Drop Table MyTable;


talk is cheap, supply exceeds demand
maxgro
MVP
MVP

T:

CrossTable(Month, Data, 3)

LOAD

  *

FROM

Data.xlsx

(ooxml, embedded labels, table is Sheet1);

F:

NoConcatenate LOAD

  ID,

    Name,

    Department,

    date(trim(Month),'MMM-YY') as Month,

    Data

Resident T;

DROP Table T;   

1.png

udaya_kumar
Specialist
Specialist
Author

Hi Gysbert,

Thanks for you reply.

I tried the above code, but converting date to date format is not working.

It is showing null (0 rows) for date field.

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Hmm, possible the values are converted to text by the crosstable function. In which case you need to convert them to numbers first:

Result:

NoConcatenate

LOAD ID, Name, Department, Date(num#(Date), 'DD/MM/YYYY')  as Date

Resident MyTable;


talk is cheap, supply exceeds demand
udaya_kumar
Specialist
Specialist
Author

Hi Maxgro,

Thanks for your reply.

It is working fine, but i have even quarter values in the date field like the attached image.

Please check it and help me.Data_Table.PNG

maxgro
MVP
MVP

I think you can use something similar to check for Quarter or Month

F:

NoConcatenate LOAD

  ID,

    Name,

    Department,

    //Date(Month, 'MMM-YY') as Month,

    if(left(Month,1)='Q', Month) as Quarter,

    if(left(Month,1)<>'Q', date(trim(Month),'MMM-YY')) as Month,

    Data

Resident T;