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

How to load a table with month stored above headers?

Hi QV Experts, my first post and new to QV scripting. I am trying to load the below sample data with the "month-year" under Header 5 (as Month), every line to repeat (Sep-19) but unsure how to script this in the code. 

Loading the headers and the data content is easy. 

I have multiple tables/files to load across in the same format too. 

Appreciate the help! Cheers 

   Sep-19
Title   
Header 1Header 2Header 3Header 4
a124
b235
c346
d457
1 Solution

Accepted Solutions
Taoufiq_Zarra

to convert 'September 2019' to date :

First Add :

Set LongMonthNames='January;February;March;April;May;June;July;August;September;October;November;December';

Capture.PNG

then you can use :

=Date(Date#('September 2019','MMMM YYYY'),'NEWFORMAT')

 

NEWFORMAT is the expected date format

for exemple :

=Date(Date#('September 2019','MMMM YYYY'),'MM-YY') the output is :

Capture.PNG

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

4 Replies
Taoufiq_Zarra

If I understood correctly ,one solution:

Suppoose My Input file is and excel with :

Capture.PNG

So initial header A,B,C,D

Data:

First 1 load Date(RangeMax(A,B,C,D),'MMM-YY') as Date

FROM
.\Classeur1.xlsx
(ooxml, explicit labels, table is Feuil1);

left join

load  [Header 1], 
     [Header 2], 
     [Header 3], 
     [Header 4]
FROM
.\Classeur1.xlsx
(ooxml, embedded labels, header is 2 lines, table is Feuil1);

you can change A,B,C,D by your header initial

output :

Capture.PNG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Redcoal
Contributor
Contributor
Author

Thanks for the recommendation 'Taoufiq', I wasn't able to get it to work. 

I followed your method but couldn't make out the RangeMax function as is essentially cell D1. I will be combining multiple files, so that date will change for each file.. 

I used the table function to remove rows/columns I don't need in order to get the cell I want. Is ugly in the codes but is sort of producing what i wanted 🙂

Redcoal_0-1594254056714.png

Another small complexity I am trying to tackle is cell D1 is stored as 'Text'. The field is actually 'September 2019'. So will need to somehow convert this to a readable date/month function. 

Any tips on coverting the text? I have been reading up from the below but not sure how to get it to work from my [Month Year] field.

https://community.qlik.com/t5/New-to-QlikView/Convert-text-to-date-format/td-p/98370

Taoufiq_Zarra

to convert 'September 2019' to date :

First Add :

Set LongMonthNames='January;February;March;April;May;June;July;August;September;October;November;December';

Capture.PNG

then you can use :

=Date(Date#('September 2019','MMMM YYYY'),'NEWFORMAT')

 

NEWFORMAT is the expected date format

for exemple :

=Date(Date#('September 2019','MMMM YYYY'),'MM-YY') the output is :

Capture.PNG

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Redcoal
Contributor
Contributor
Author

Your method works for me. 

Thanks for your help!