Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

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
Honored Contributor III

Re: Variable on a Variable on Load Data

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

Re: Variable on a Variable on Load Data

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
Honored Contributor III

Re: Variable on a Variable on Load Data

Please post sample data and/or sample app.