Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I'm stuck with an issue with subtraction. My data contain two variables was trying to subtract them but it is not working properly
Set vCountry=1,
Set vValue =if(vCountry =1,Localcurrency, Localcurrency*exchangerate)
Set vSale =if(vCountry=1,Sales,Sales*exchangerate)
above is the variables I have created for my data and was trying to subtract them as below.
vValue -vSale
I am getting result for local values but not the converted values i.e if country is 0 or more than 1 then it should convert using exchange rates but it is not working as expected
Can some one help me out.
Thanks.
May be try with parenthesis
(vValue) - (vSale)
Hi Sunny,
Sorry missed to mention.I used
sum(vValue) -sum(vSale)
One more point the code is working when I use the expression
sum(if(vCountry =1,Localcurrency, Localcurrency*exchangerate)) - sum(
if(vCountry=1,Sales,Sales*exchangerate)
)
instead of variable that where I'm confused should I use any function before this variables to make the subtraction to work??
Are you using an equal sign when you store this in the variable? May be remove the equal sign from the expression and then check
Hi,
Instead of SET use LET to store value.
Hi Sunny,
I defined as mentioned above,can you please tell me if any thing wrong in above statement
Hi,
Try this
$(vValue) - $(vSale)
in text box,
where as in expression,
Sum($(vValue) )- Sum($(vSale))
Hi Sumanth,
Since I used set to store the variable I prefixed it with $ while using in expression.
The variables seem ok, but AFAIK the way you try to use their content is wrong. You don't want to use a LET statement or preliminary variable evaluation by prefixing the string in each with an equal sign. Both lead to either errors or nothing.
You want simple text substitution so that
Sum(Variable)
leads to
Sum(ExpressionInsideVariable)
before the Sum() is calculated. Please try with
=Sum($(vValue)) - Sum($(vSales))
Hi Peter,
Please find the my expression below.