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: 
Not applicable

Variable on a Variable on Load Data

I have used the variable interface on the front end of Qlik Sense and it is difficult to see what is happening. I then moved the variables to load when the data loads, except that when I load a variable on a variable it does not work.

// Monthly Variables For Sales

set v_Week_STTT_Current_Year = '=max({<TransactionType={"STTT_WEEK_SALES_RANDS"}>}_KeyActualYearID)';

WORKS; Answer is 2018

set v_Week_STTT_Previous_Year = '=$(v_Week_STTT_Current_Year) - 1';

WORKS; Answer is 2017

Set v_Week_STTT_Current_Month = '=max({<TransactionType={"STTT_WEEK_SALES_RANDS"},FinancialYear={"=(v_Week_STTT_Current_Year)"}>}_KeyActualMonthID)';

DOES NOT WORK: Answer given is 12 where data is only loaded up to 6

Set v_Week_STTT_Current_Week = '=max({<TransactionType={"STTT_WEEK_SALES_RANDS"},FinancialYear={"=(v_Week_STTT_Current_Year)"}>}ActualWeekLink)';

DOES NOT WORK: Answer given is 52 where data is only loaded up to 32


How do I refer to a variable within a variable on load script?

3 Replies
sasiparupudi1
Master III
Master III

May be try like following

LET v_Week_STTT_Current_Year = 'max({<TransactionType={"STTT_WEEK_SALES_RANDS"}>}_KeyActualYearID)';

LET v_Week_STTT_Previous_Year = '$'&'(v_Week_STTT_Current_Year) - 1';

LET v_Week_STTT_Current_Month = 'max({<TransactionType={''STTT_WEEK_SALES_RANDS''},FinancialYear={'&chr(39)&'$'&'(=v_Week_STTT_Current_Year)''}>}_KeyActualMonthID)';

LET v_Week_STTT_Current_Week = 'max({<TransactionType={''STTT_WEEK_SALES_RANDS''},FinancialYear={'&chr(39)&'$'&'(=v_Week_STTT_Current_Year)''}>}ActualWeekLink)';

Not applicable
Author

Hi Sasidhar.

Thanks for the response and attempt. Using your suggestion I got the following responses.

v_Week_STTT_Current_Year = WORKS; Answer is 2018

v_Week_STTT_Previous_Year = WORKS; Answer is 2017

v_Week_STTT_Current_Month= DOES NOT WORK: Answer given is BLANK / NOTHING where data is only loaded up to 6

v_Week_STTT_Current_Month= DOES NOT WORK: Answer given is BLANK / NOTHING where data is only loaded up to 32

sasiparupudi1
Master III
Master III

Please post sample data and/or sample app.