3 Replies Latest reply: Jul 27, 2012 5:52 AM by saurabhk_qv RSS

    Need to Reuse expression definition

      Hello Folks,


      I am developing multi-tab report in Qlikview 11. I want to create a generic code which I can use at multiple places like below.


      I have input box in which I am setting currency_var (GBP,USD etc)


      I created variable as


      Variable : Currency_Rate


      =if( currency_var = 'USD', 50, if ( currency_var = 'GBP' , 79,0))


      and used that variable in expression of my pivot chart. as below


      Expression : Amount


      = sum( Revenue * Currency_Rate)


      But it shows 0 when I put the variable. But if I replace my definition in expression to


      =sum( Revenue * if(currecy_var = 'USD',50,if( currency_var = 'GBP', 79,0)) )


      then it works. I want to reuse the "Currency_rate" definition at many places so that whenever factor is changed I can just change variable and get effect across all such expressions implemented in document.


      any ideas ?


      Thanks in advance