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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
rammuthiah
Creator III
Creator III

Load data based on max date

I tried loading data based on max date from file name.

While trying to call in a variable, it's not working.

Is there any way to loa

Capture.JPG

1 Solution

Accepted Solutions
agigliotti
MVP
MVP

I think you should use a loop to load all file names in your table.

how your script do it ?

The Power of shining a light on the dark side of your data.
Follow me on my LinkedIn | Know Gamma Informatica at gammainformatica.it

View solution in original post

13 Replies
bramkn
Partner - Specialist
Partner - Specialist

Post your script please. We can't see what you are doing wrong like this. And yes it is possible.

rammuthiah
Creator III
Creator III
Author

///////////

Load

    date(date#(trim(left(subfield(FileName(),'DataFileName -',2),11)),'YYYY-MM-DD'),'DD-MM-YYYY') aS Source

From ExcelTable...

////////////

Let vMaxFileDate=date(max(Source,'MM/DD/YYYY'));

Anonymous
Not applicable

Hi

try this may be

Master:

ID,

date

from Master.qvd;

Max:

load max(date) as maxdate

resident Master;

Let  vMax = peek('maxdate',0,'Max')

Drop table Max;

Transaction:

join(Master)

Load

ID,

date

From Transaction.qvd

where date >'$(vMax)';

agigliotti
MVP
MVP

let's try below code:

table_name:

Load

    max( date(date#(trim(left(subfield(FileName(),'DataFileName -',2),11)),'YYYY-MM-DD'),'DD-MM-YYYY') ) as Source

From ExcelTable...

Let vMaxFileDate = Peek( 'Source', 0, 'table_name');

The Power of shining a light on the dark side of your data.
Follow me on my LinkedIn | Know Gamma Informatica at gammainformatica.it
rammuthiah
Creator III
Creator III
Author

Eventhough I am getting the min date not the max Date. Here the max date is 2018-07-12

Capture.JPG

bramkn
Partner - Specialist
Partner - Specialist

where date >= '$(vMax)'; Dont forget the '=' other wise it won't find anything can even discard '>' and also using the match function here would help a little bit with performance.

agigliotti
MVP
MVP

I think you should use a loop to load all file names in your table.

how your script do it ?

The Power of shining a light on the dark side of your data.
Follow me on my LinkedIn | Know Gamma Informatica at gammainformatica.it
rammuthiah
Creator III
Creator III
Author

In file name only I have date. based on the date have to load the maximum date file only. Help me to resolve this in script

bramkn
Partner - Specialist
Partner - Specialist

Load all file names first then get the part that has the date and max that. and then use it with wildcards to only load that date.