Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Good day,
I am trying to create a calculated field in load editor based on variables and another calculated field. The expression is as below:
/*
if( qda_score > Floor($(vPlusTwoStDevQda)),'Very High',
if (qda_score <= Floor($(vPlusTwoStDevQda))
and
qda_score > ceil($(vPlusOneStDevQda)) ,'High',
if (qda_score <= Ceil($(vPlusOneStDevQda))
and
qda_score >= ceil($(vAvgQda)) ,'Medium',
if (qda_score <= floor($(vAvgQda))
and
qda_score >= ceil($(vMinusOneStDevQda)) ,'Low',
if (qda_score < ceil($(vMinusOneStDevQda)) ,'Very Low'
))))) as Qda_Profile_Rank,*/
qda_score - this field is a calculated field too.
The variables in the expression are created at chart level.
1.Can these variables be used in the load editor(some of the variables have aggr function used in them).
2.And also ,have I referred to the variables in the right way(syntactically).
Thanks!
1. You will not be able to use variables with aggr() in script because aggr() is not a valid script function. As for other variables, you may or may not be able to use them depending on whether they contain valid script syntax that also works in the context of the expression and load you're using them in.
2. That depends on what the variables contain. Generally speaking, $(VariableName) works, but whether or not it will return the result you expect depends on what the variables contain. I recommend reading these two posts, as well as referring to the documentation, for a better understanding of how dollar sign expansion and variables combine.
https://community.qlik.com/t5/Qlik-Design-Blog/The-Magic-of-Variables/ba-p/1465499
https://community.qlik.com/t5/Qlik-Design-Blog/The-Magic-of-Dollar-Expansions/ba-p/1471979
Thank you so much. The information you provided helped.
I was actually referring to a field in a variable which was not loaded yet. So I created a temp table and did a resident load of the field and then assigned the variable with that field.
MinQdi:
Load Min(Qdi_Score) as MinQdi
Resident data_qlik_2_temp;
Let vMin_Qdi2 = Peek('MinQdi',-1);
My variables are populating now.