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

how to resue expression

Something like Sum( Sales ) / Count( distinct MonthID & '|' & CustomerID ) is hard to read when analystics calculation gets complicated.

I am thinking to save this expression somewhere with a name "avg sales", then reuse it by invoking the name "avg sales" where I need?

Does Qlikview support and how if yes. Thanks.

1 Solution

Accepted Solutions
petter
Partner - Champion III
Partner - Champion III

Yes - you can put the expression in a variable and in the place of the expression in your Sheet Object you can use $-sign expansion to evaluate the contents of the variable so it calculates the expression contained in the variable.

The variable can be declared in your load script or via the user interface menu: Settings/Variables Overview/Add or the menu: Settings / Document Properties / Variables Tab / New.

Something like:

    avg_sales = 'Sum( Sales ) / Count( distinct MonthID & '|' & CustomerID )'

And then use this variable like this:

    $(avg_sales)

In various places in Sheet Objects that allow expressions.

View solution in original post

2 Replies
maxgro
MVP
MVP

you can use variables (ctrl+ alt + v) to store expression

and reuse in different charts

petter
Partner - Champion III
Partner - Champion III

Yes - you can put the expression in a variable and in the place of the expression in your Sheet Object you can use $-sign expansion to evaluate the contents of the variable so it calculates the expression contained in the variable.

The variable can be declared in your load script or via the user interface menu: Settings/Variables Overview/Add or the menu: Settings / Document Properties / Variables Tab / New.

Something like:

    avg_sales = 'Sum( Sales ) / Count( distinct MonthID & '|' & CustomerID )'

And then use this variable like this:

    $(avg_sales)

In various places in Sheet Objects that allow expressions.