4 Replies Latest reply: Jan 10, 2017 1:01 AM by Pratik Kar RSS

    Sum of Multiple Variables

    Pratik Kar

      Dear All,


      Unable to sum two variables. Please assist.

      I have tried the following after Creating a  new variable V_tester in the Variables Overview


      V_tester = $(Var_1) + $(Var_2)




      V_tester = Var_1 + Var_2


      This is in Qlikview and not in the script.


      Please sugesst how do I add.


      With regards

        • Re: Sum of Multiple Variables
          Vineeth Pujari

          Try below

          V_tester = $(=Var_1) + $(=Var_2)


          =rangesum( $(=Var_1) , $(=Var_2))


          please also post expression for these two variables if the issue persists

          • Re: Sum of Multiple Variables
            Petter Skjolden

            One of the fastest ways of debugging your expressions and variables is by using an INPUT BOX. The input box can show several variables at once and any type of QlikView expression can be written and evaluated directly in an input box.


            Create a new input box and add your three variables like this:

            2017-01-08 13_34_25-QlikView x64 - [QV1].png


            2017-01-08 13_34_40-QlikView x64 - [QV1].png


            2017-01-08 13_35_19-QlikView x64 - [QV1].png


            Then you can immediately inspect all three variables and modify them to see what it evaluates to.


            Example - if you have the two variables Var_1 and Var_2 populated with 456 and 890:


            2017-01-08 13_38_08-QlikView x64 - [QV1].png


            2017-01-08 13_38_31-QlikView x64 - [QV1].png



            It might seem like your variables don't evaluate to numbers - thus adding them together will not give you a numeric result - possibly and error. Like this:


            2017-01-08 13_41_25-QlikView x64 - [QV1].png



            For me Input Box is an invaluable aid in getting my expressions correct and saving a lot of time while debugging them.

            • Re: Sum of Multiple Variables
              jagan mohan rao appala



              What are the values you are getting in the two variables Var_1 + Var_2?   Check it by using Text Objects or by using Input boxes.


              If you are getting one of the variable value as Null, then better use RangeSum()


              =RangeSum(Var_1, Var_2)



              Hope this helps you.