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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
vchuprina
Specialist
Specialist

How load date from line?

I've received files with date inside. Now I want update  parser to automatically determine the date.

I have two question:

- How load date from line? I suppose, first I should determine row with date and them drop 'Data as of:'  

- On picture below date is '3/1/2015', but this was Sunday and I need to load this data as 'Last Saturday'. Is there any function, that can automatically change date to last Saturday( for example 3/1/2015 - > 2/28/2015)

Thanks,

Vitaliy

Press LIKE if the given solution helps to solve the problem.
If it's possible please mark correct answers as "solutions" (you can mark up to 3 "solutions").
1 Solution

Accepted Solutions
anbu1984
Master III
Master III

LOAD Subfield(@1,':',2), Date(WeekStart(Date#(Trim(Subfield(@1,':',2)),'MM/DD/YYYY'))+5)

FROM

[Input.txt]

(txt, codepage is 1252, no labels, delimiter is '\t', msq)

Where Index(@1,'Data as of');

View solution in original post

3 Replies
prieper
Master II
Master II

As you mentioned already: Make a separate load with line number two only and extract the date. (In a second go then you would load the data starting with headers at line #5).

Not quite clear on the date: If it is always Sunday, you may deduct just one day. Else you may work with the function WEEKSTART with parameter offset.

HTH Peter

anbu1984
Master III
Master III

LOAD Subfield(@1,':',2), Date(WeekStart(Date#(Trim(Subfield(@1,':',2)),'MM/DD/YYYY'))+5)

FROM

[Input.txt]

(txt, codepage is 1252, no labels, delimiter is '\t', msq)

Where Index(@1,'Data as of');

Gabriel
Partner - Specialist III
Partner - Specialist III

Hi,

Use WeekStart function, see below, to derive last Saturday's date.

WeekStart(DateField,0,-1)

Hope this helps