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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set Expression not working using variable

Dear Team, My set expression

Sum({< [Ledger] = {"41*"},Year = {'$(=GetFieldSelections(Year)-1)'} >}Ballance)

is perfectly working when i use as an expression in Qlik sense sheet. But as a Set Variable in the script it is not working.

SET lsale = Sum({< [Ledger] = {"41*"},Year = {'$(=GetFieldSelections(Year)-1)'} >}Ballance);

Expression in sheet = $(lsale)

All other expressions are working via SET, but wherever i use Year = {'$(=GetFieldSelections(Year)-1)'} for prior year of selected year, it is showing 0 as output.

I tried SET Previousyear = GetFieldSelections(Year)-1); then used in set but still not working.

Please suggest the wayout...

Thanks

Shiv

Labels (3)
1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try LET lsale = 'Sum({< [Ledger] = {"41*"},Year = {"$' & '(=GetFieldSelections(Year)-1)"} >}Ballance)' ;


Or


SET lsale = Sum({< [Ledger] = {"41*"},Year = {'@(=GetFieldSelections(Year)-1)'} >}Ballance);

LET lsale = replace($(lsale),'@','$');


talk is cheap, supply exceeds demand

View solution in original post

1 Reply
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try LET lsale = 'Sum({< [Ledger] = {"41*"},Year = {"$' & '(=GetFieldSelections(Year)-1)"} >}Ballance)' ;


Or


SET lsale = Sum({< [Ledger] = {"41*"},Year = {'@(=GetFieldSelections(Year)-1)'} >}Ballance);

LET lsale = replace($(lsale),'@','$');


talk is cheap, supply exceeds demand