Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
adamdavi3s
Master
Master

varible expression in variable expression

Hi All,

Having a daft moment and can't remember the answer to this

example:

vCost:  sum(cost)

vIncome:  sum(Income)

I have something like pick(match(dimension,'Cost','Income'),$(vCost),$(vIncome))

How do I then stash this in a variable that can be used at row level in a chart:

e.g if I do this, it obviously gives the same answer for every row as the cost and income variables are calculated at the chart level

vPickMatch: pick(match(dimension,'Cost','Income),$(vCost),(vIncome))


stalwar1‌ help me out, its been a while!

6 Replies
tresesco
MVP
MVP

While defining the variables, try removing the '=' from the front.

adamdavi3s
Master
Master
Author

Yes sorry the variables do not have an = in the start (variables 101!), my OP is misleading and now corrected

tresesco
MVP
MVP

Could you share your sample qvw?

sunny_talwar

And are you using your variable with dollar sign expansion or not? I think you need to use $(vPickMatch) instead of vPickMatch only

adamdavi3s
Master
Master
Author

I just spun up a quick demo and it works as I expected... Must be something in my main app DM causing the issue!

I

adamdavi3s
Master
Master
Author

Yeah I was, thought I was having a funny 5 but think it must be something else...