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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
asmithids
Partner - Creator II
Partner - Creator II

Variable in Set Analysis Not Working

Hello,

I created the following variable and used it in the set analysis expression.  The issue is that when I select a date in the Year-Month dimension, I am not getting any results as expected.  The expression is supposed to sum all payment amounts for all previous periods from the date selected in the Year-Month field.  The variable in the expression turns "active" when I remove the " "  but, the result is null.  When I include the " ", the variable turns to plain text and the result is 0.00.  I tested the results of the variable to the values in the Year-Month field and they match (i.e. 2018-Jun to 2018-Jun).  I know I'm close but don't see where I'm not correct.

Thank you in advance for any assistance!!

Variable: vYearMonth = GetFieldSelections([Year-Month])

Sum({$<Year=,Month=, [Year-Month]={"<$(vYearMonth)"}>}PaymentAmount)

3 Replies
dplr-rn
Partner - Master III
Partner - Master III

it needs to be "" because its a search (the less than < part)

How is your variable defined? is it defined as =GetFieldSelections([Year-Month]) or without the = sign.

if latter use $(=[Year-Month]) in the set analysis

Whats the type of your Year month column?

asmithids
Partner - Creator II
Partner - Creator II
Author

Hi Dilip,

See attached variable script defined and the type for the Year-Month field. Also, I agree the " " are required.  Still not sure why it's not working. 

dplr-rn
Partner - Master III
Partner - Master III

did you try $(= in the set analysis? Your variable definition does not have an = so i would

use $(=vMonthYear)