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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
ariaseze
Partner - Contributor III
Partner - Contributor III

Last year in set analysis expression in the load script

Hi, experts!

I have the following inconvenience, I need the last year before the selected one and then use it in the set analysis of another variable, all this inside the load script.

I tried this but only work if I use the content of variable directly on text object but not work if I use "Cant" in other formula in load script:


([Year] is a Field).

SET Cant= COUNT({<MonthYear,Year={$(=MAX([Year])-1)}>}  DISTINCT IF(Date_Holiday >= ($(vInv_Date)) ) );      (Work on Text Object)


SET OtherFormula = SUM ( $(A) + $(Cant) ) ;     (Not Work in Load Script)

Thanks in advance!

SET Cant= COUNT({<MonthYear,Year={$(=MAX([Year])-1)}>}  DISTINCT IF(Date_Holiday >= ($(vInv_Date)),)); SET OtherFormula = SUM ( $(A) + $(Cant) ) ;
11 Replies
ariaseze
Partner - Contributor III
Partner - Contributor III
Author

But that is precisely the problem, in order to be maintainable and not indecipherable code, I need to solve it in the load script, and NOT in the text object, that is to say, I need to use the variable created in the script in the text object because the code in the text object itself is already complex.

zebhashmi
Specialist
Specialist

I think you can use this formula to pass it to Variable. Do fix the Data in Table so that it has associations and try.

I think you would have to have a variable after a load of the table. let me check

I think you will need LET instead of SET