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

Replace the data from a new file's date

Hello,

I've got the following data source files:

File_01.02.2018.xlsx  // plan for February

File_03.02.2018.xlsx // plan for February with changes

File_01.03.2018.xlsx // plan for March

... etc.

Question/ Issue:

Every time we get a new file with changes (within one month), we need to replace the data from a new file's date and till the end of the month.

P.S. The data doesn't contain any "date" fields etc. Date is stored only in the file's header.

Attempts:

I know that there's the REPLACE LOAD statement but it won't work for this case.

Data:

Replace LOAD

Store,

Week,

Day, // Thu, Fri,...

Flag, // 1 or null

Month(Date( Date#( right( FileBaseName(), 10) , 'DD.MM.YYYY'), 'DD-MM-YYYY')) as Month,

Year(Date( Date#( right( FileBaseName(), 10) , 'DD.MM.YYYY'), 'DD-MM-YYYY')) as Year

FROM

Expected result:


File_01.02.2018.xlsx

StoreThuFriSatSun
PN1
CHE1111
PN1

File_03.02.2018.xlsx

StoreThuFriSatSun
PN111
CHE11
PN11

01.02.2018 is Thursday and 03.02.2018 is Saturday so we need to start replacing from Saturday

Result plan for February:

StoreThuFriSatSun
PN111
CHE111
PN111

With my best regards,

Evgeniy

10 Replies
bramkn
Partner - Specialist
Partner - Specialist

Ah ok, I forgot about that.