Announcements
cancel
Showing results for
Did you mean:
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 ?

1 Solution

Accepted Solutions
Partner - Champion III

Hi

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

=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
Partner - Champion III

Hi

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

=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
Partner - Master II

try this :

= sum( Revenue * \$(Currency_Rate))

Not applicable
Author

Thanks Jonathan, Ioannis.. It worked !!!

Community Browser