New to Qlik Analytics

If you’re new to Qlik Cloud or Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!

Who Me Too'd this solution

rubenmarin

Hi, you can check in the logs how the values are converted, or use the TRACE sentence to check values while loading, or do a debug reload to check the variable values after each step.

I think the max in max(date(day, 'DDMMYY')) is making the value to be stored as number( ie. 44629 instead of 090322). Also you cant refer to a field just calling it, you need to use Peek or Lookup.

Another thing is that using an operator like > with DDMMYY format may be wrong, it should be YYMMDD. As an example 300122 is higher than 090322. If you change to YYMMDD 220130 is lower than 220309.

And lastly the FileBaseName() function don't expect a parameter, it returns the filename of the file beign loaded, so it only works on LOAD. Try extracting file name from the file variable.

So try to assign the variable as

Let vMaxDate = Date(Peek('MaxDate',0,'Max_table'),'YYMMDD');

And the condition to:

LET vFileName = Subfield(Subfield('$(file)','\',-1),'.',1); // keep the text between the last \ and the dot.
LET vFileDate = Right('$(vFileName)',2) & Mid('$(vFileName)',3,2)&Left('$(vFileName)',2);

if $(vFileDate) > $(vMaxDate) Then

 

View solution in original post

Who Me Too'd this solution