Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I am trying to store the selected values in a variable, then use the variable in set analysis.
Method 1:
step1: create variable vMonth=GetFieldSelections(Months in List box),
step2: in set analysis expression, I use =sum({<Date={"$(vMonth)"}>}sales);
Method 2:
step1: create variable vMonth==concat(distinct (Months in List box), chr(39)&', '&chr(39)),
step2: in set analysis expression, =sum({<Date={'$(vMonth)'}>}sales);
Neither of these two methods don't work with variables. If I use GetFieldSelection or Concat directly in set analysis expression , both are working.
=sum({<Date={"$(=GetFieldSelections(Months in List box))"}>}sales)
=sum({<Date={'$(=concat(distinct (Months in List box), chr(39)&', '&chr(39)))'}>}sales)
Not sure if I miss anything, any suggestions? Thx.
Just figure out this issue. I am defining different alternate states in each sheet, so need put state name when creating variables.
Method 1:
step1: create variable vMonth=GetFieldSelections(Months, ',', 100, 'StateName'),
step2: in set analysis expression, I use =sum({<Date={"$(vMonth)"}>}sales);
Method 2:
step1: create variable vMonth=concat({[AlternateStateName]}distinct (Months in List box), chr(39)&', '&chr(39)),
step2: in set analysis expression, =sum({<Date={'$(vMonth)'}>}sales);
both $(vMonth) or $(=vMonth) working.
Thanks everyone.
hello
did you try
$(=vMonth)
?
Why don't you try just this
Sum({<Date = p(Months)>}sales)
Thanks Sunny. Either GetFieldSelections or Concat expression work, now I am trying to make the variable method working.
Thank you Robin. I did, but no luck here.
But p() doesn't work?
Hi,
You have to use both concat and get field selections.
Because when multiple values are selected values will be displayed like A,B we need make it 'A','B' as the variable result.
Thanks,
Shan S
Hi Sunny, I didn't try, it might work. My focus on this question is trying to make the variable method working, not find workaround solution The P() function might work, in my post, using GetFieldSelections or Concat directly in set analysis expression also work. I am new to Qlik and try to learn more stuff during projects. Thx.
yzhang88 - you are free to try and learn, but p() is not a work around.... what you are trying is work around and that too longer work around which I would recommend not using over p().... If I were new, I would first learn p() and then go onto learning other ways of doing it
Just figure out this issue. I am defining different alternate states in each sheet, so need put state name when creating variables.
Method 1:
step1: create variable vMonth=GetFieldSelections(Months, ',', 100, 'StateName'),
step2: in set analysis expression, I use =sum({<Date={"$(vMonth)"}>}sales);
Method 2:
step1: create variable vMonth=concat({[AlternateStateName]}distinct (Months in List box), chr(39)&', '&chr(39)),
step2: in set analysis expression, =sum({<Date={'$(vMonth)'}>}sales);
both $(vMonth) or $(=vMonth) working.
Thanks everyone.