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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
juandevqlik
Contributor III
Contributor III

Variable set in editor not working as i though

Hi,

I would like to sum salaries depends on the date selected, so i have this:

I created a table in the script, like this:

Date_Table:

[Date_of_Job

"31-01-1999",

"25-03-2020"]

Then i created a variable:

Set vDate_Joob  =    '= Date_of_Job'

Then in the same script i created the variable to sum salaries

Set vsalary = sum({$<Date = $(vDate_Joob)>}salaries)

And then i have a filter with the dimension vDate_Joob, so the thing is when im using inside qlik the formula $(vSalary) it doesnt work, but if i use the formula instead of the variable (sum({$<Date = $(vDate_Joob)>}salaries)) it works!!. Anyone knows how can i change this? i need to use the variable not the formula

Thanks

1 Reply
rubenmarin

Hi, $( is converted to the value inside the () when the script executes, and at that time it doesn't have any value, and if it had it will be a fixed value.

You can avoid that using replace(), like:

LET vsalary = Replace(sum({$<Date = #(vDate_Joob)>}salaries),'#','$');

Or load the expression from an external file, I can't find the post explaining this but is close to this answer:

https://community.qlik.com/t5/QlikView-App-Dev/Variables-with-SA-declaration-from-excel-file/td-p/82...