2 Replies Latest reply: Mar 8, 2015 11:27 AM by Petter Skjolden RSS

    how to resue expression

    surfman joe

      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.

        • Re: how to resue expression
          Massimo Grossi

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

          and reuse in different charts

          • Re: how to resue expression
            Petter Skjolden

            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.