Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Not applicable

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

1 Solution

Accepted Solutions
MVP
MVP

Re: Need to Reuse expression definition

Hi

First, create the variable without a leading = sign (so that you save the expression rather than the result)

Second, your expression should read

     =Sum(Revenue * $(Currency_Rate))

     or (if that does not work

     =Sum(Revenue * $(=$(Currency_Rate)))

Hope that helps

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
3 Replies
MVP
MVP

Re: Need to Reuse expression definition

Hi

First, create the variable without a leading = sign (so that you save the expression rather than the result)

Second, your expression should read

     =Sum(Revenue * $(Currency_Rate))

     or (if that does not work

     =Sum(Revenue * $(=$(Currency_Rate)))

Hope that helps

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
giakoum
Honored Contributor II

Re: Need to Reuse expression definition

try this :

= sum( Revenue * $(Currency_Rate))

Not applicable

Re: Need to Reuse expression definition

Thanks Jonathan, Ioannis.. It worked !!!

Community Browser