Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
hykal1993
Contributor II
Contributor II

Two Files Loaded (To be used as dimension)

I have two files with the exact data fields (one is extracted on Jan 2018, another on Feb 2018). We would like to put the dates of extraction as the y-axis on the grid chart. What should I do, attached is the data. 

Note: The fields are much more than the two attached and some of the field might be used for the colour of the bubble chart. Additionally, we would like to extend this to a 12 month trend. 

Thank you so much for your help!

 

 

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Oops, typo. Try SubField instead of SubFile.


talk is cheap, supply exceeds demand

View solution in original post

6 Replies
Gysbert_Wassenaar

If you want to extract the period from the file name you can use the FileName() function in the load statement. Something like

MyData:
LOAD
   ...lots of fields...,
   Date#(SubField(FileName(),'.',1),'MMM YYYY') as Period
FROM
    [D:\MyExcelFiles\*.xlsx] (ooxml, ...etc);

talk is cheap, supply exceeds demand
hykal1993
Contributor II
Contributor II
Author

Anything wrong with my code? It seems off and there's an error. 

LOAD ID, 
     [Risk Type],
     Date#(SubFile(Jan 2018.xlsx,'.',1),'MMM YYYY') as Period
     
FROM
[C:\Users\haab\Desktop\Jan 2018.xlsx]
(ooxml, embedded labels, table is Sheet1);
Gysbert_Wassenaar

Try using the FileName() function instead of the name of the file.

talk is cheap, supply exceeds demand
hykal1993
Contributor II
Contributor II
Author

Still there's an error.

LOAD ID,
     [Risk Type],
     Date#(SubFile(FileName(),'.',1),'MMM YYYY') as Period
     
FROM
[C:\Users\haab\Desktop\Feb 2018.xlsx]
(ooxml, embedded labels, table is Sheet1);
Gysbert_Wassenaar

Oops, typo. Try SubField instead of SubFile.


talk is cheap, supply exceeds demand
hykal1993
Contributor II
Contributor II
Author

LOAD ID, 
     [Risk Type],
     Date#(SubField(FileName(),'.',1),'MMM YYYY') as Period
FROM
[C:\Users\haab\Desktop\Jan 2018.xlsx]
(ooxml, embedded labels, table is Sheet1);

LOAD ID as [Feb ID], 
     [Risk Type] as [Feb Risk Type],
     Date#(SubField(FileName(),'.',1),'MMM YYYY') as Period
FROM
[C:\Users\haab\Desktop\Feb 2018.xlsx]
(ooxml, embedded labels, table is Sheet1);

Thanks, now there's no longer errors. However, I'm trying to build Grid Chart and the period (Y-Axis) is only showing Jan 2018. The Feb 2018 is missing.