5 Replies Latest reply: Jun 28, 2013 1:43 PM by Gysbert Wassenaar RSS

    When to use = in expressions?

      Hello, I'm new to QlikView, but I have some experience as a programmer. My question is: sometimes I see examples both on this site and in the .qvw documents I work on where an expression, calculation condition, or other conditional starts with an = sign and sometimes not.


      What is the difference? For example, this is the expression definition in one of our charts:


      Sum({$<[ContractType] = {"Technical Document","Informational"}>} [Focused Contracts])


      what if it were:

      =Sum({$<[ContractType] = {"Technical Document","Informational"}>} [Focused Contracts])

        • Re: When to use = in expressions?
          Nizam HM

          =Sum({$<[ContractType] = {"Technical Document","Informational"}>} [Focused Contracts])


          first  sum([Focused Contracts])   actually this is a expressinon

          second one {$<[ContractType] = {"Technical Document","Informational"}>} inside the expression we r writing set analysis for dynamic calculation

          ContractType is a fieldname

          "Technical Document  and Informational is a value in contract type field


          for eg

          year //this is a field name

          2007// these and all values




          in set wwe use =before the function eg(=MAx(sales)) or (=only(sales)),(=year(currentyear)) like ths wwe use

          • Re: When to use = in expressions?
            Gysbert Wassenaar

            It often doesn't matter. Where is does matter is in variables. If a variable contains an expression the = sign then the expression will be evaluated directly and not in the context of the chart the variable is used in. See attached qvw for an example. The chart has two expressions that each use a variable. The first variable contains an expression that starts with the = sign. It returns the overall maximum transaction date. The second expression returns the maximum transaction date for the SalesPerson. That's because the expression in the first variable is calculated before the dimension values are applied. The second takes the dimension value into account and so returns the maximum transaction date for the individual sales persons.