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

How can I store dynamic values in the variables using formulae

I have declared variables

After pressing   ctrl+alt+V  I get the variables settings I wrote formula in the definition of the variable. but when I am using that variable It is displaying that written formula in it not he value I want.

Please tell me if I am doing it write or not and what can be the correct way to do it.

Also haow can I store all the fields of a column in a grid in different variables

for e.g.

A  B

a   1

b   2

c   3

d   4

I have two columns in the gird A is dimension and B is expression I want to store all the values of B in four variables, How can I achieve that. Please help

Best Regards,

Gaurav Tyagi

4 Replies
jagan
Partner - Champion III
Partner - Champion III

Hi Gaurav,

For the first question, I think you missed = sign before the expression.  If you give =, it evaluates the expression and stores the result in variable.

For storing values of Dimension in variables is

v1= FieldValue('B',1)

v2= FieldValue('B',2)

v3= FieldValue('B',3)

v4= FieldValue('B',4)

Hope this helps you.

Regards,

Jagan.

Siva_Sankar
Master II
Master II

Hi Gaurav,  For your 1st questions, it will display the formula that you've given in the expression instead of value when you omit the '=' sign.  Example:  if you're using the formula for the variable: vYTDyear==max([Fiscal Year])  then while getting the value of the formula expression you need to use it as:  =vYTDYear  For your 2nd question, you may check the following link  http://community.qlik.com/message/165526#165526  Regards. Siva Sankar K

Not applicable
Author

test.png

Guys,

YTM data is my grid and the formula I am trying to use is

V1=if(Seg='S04',yRevenue-yOther Income,0)

What I want is to store the the values of the Revenue column into variables so that I can add them for total later

I can not use sub totals because for rest of the columns I am using ratios or average as final totals.

So I am trying to put the values of all the fields from S02 to S12 in variables and then add them later coz they changes dynamically.

Thanks for your response guy. Much appreciated.

Best Regards,

Gaurav Tyagi

Not applicable
Author

hi Jagan,

It was helpful. But what's the case if i want to store the value of that particular value of field into a single variable.

~Walter