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: 
karolina_
Creator II
Creator II

variable not working in chart

Hi All,

hope someone can help me with below problem

I have following variable vVar:

if(GetSelectedCount([Group])<>0,

Sum([Year 1])/GetSelectedCount([Group]),

Sum({<[Group]={$(vTarget)}>} [Year 1]))


I call it $(vVar) and it shows correctly in text box,but it does not apear at all in chart and table (both using valulist).

Note if I paste it directly in chart it's working ok.

If the last line (else filed) is different

if(GetSelectedCount([Group])<>0,

Sum([Year 1])/GetSelectedCount([Group]),

Sum([Year 1])/GetPossibleCount([Group]))
It's then working fine everywhere.

I tried to use

Sum( if([Group]=vTarget,[Year 1],0))

instead of

Sum({<[Group]={$(vTarget)}>} [Year 1]))

but it behave exactly the same

1 Solution

Accepted Solutions
sushil353
Master II
Master II

Have u tried this:

f(GetSelectedCount([Group])<>0,

Sum([Year 1])/GetSelectedCount([Group]),

Sum({<[Group]={'$(vTarget)'}>} [Year 1]))

HTH

Sushil

View solution in original post

2 Replies
sushil353
Master II
Master II

Have u tried this:

f(GetSelectedCount([Group])<>0,

Sum([Year 1])/GetSelectedCount([Group]),

Sum({<[Group]={'$(vTarget)'}>} [Year 1]))

HTH

Sushil

karolina_
Creator II
Creator II
Author

I have
$(vTarget)=Target

and I earlier tried $(vTarget)='Target'

After successfully checking your version i checked above again and it's working as well..

Thank you

edit: I have two more similar and were not working till i removed commented part of code in variable definition