Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Store formulas in variable

Hi all,

I am very new in Qlik, and I would like to know how to give my users predefined formulas that they can use in their expressions. For example, I want to create a variable named sum_qty = "sum(QTY)" and I want my user to use sum_qty in his expression, but I am not able to get it to work.

Thank you in advance

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Define the variable in one of two ways:

1. In the script:

SET sum_qty=sum(QTY);

2. In the Variable overview dialog.

Users then reference the variable in an expression as:

$(sum_qty)

-Rob

View solution in original post

8 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Define the variable in one of two ways:

1. In the script:

SET sum_qty=sum(QTY);

2. In the Variable overview dialog.

Users then reference the variable in an expression as:

$(sum_qty)

-Rob

Not applicable
Author

Hi Carlo, you can store the expressions in an xl spreadsheet and read these expressions in your script.

its_anandrjs

Hi,

Yes you can

make a variable named QTY_SUM = Sum(QTY)

And use this variable in any expression like  $(QTY_SUM)

Rgds

Anand

its_anandrjs

Hi,

See the sample file

Rgds

Anand

Not applicable
Author

Thank you all very much, I was not able to reference the variable in the expression

Regards

its_anandrjs

Hi,

You can use any type of formulas like Max,Min,Sum,Count etc

See the attached sample file.

Rgds

Anand

its_anandrjs

Hi,

You have to use the values of stored variables in expression like

See the attached sample file

Rgds

Anand

Not applicable
Author

It would be a good idea to check the way you are defining the variables and the way you are using them as qv is case-sensitive. It maybe something as small as this that maybe hampering the ref.