Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
Need help in setting the background color right using the if statement.
If(curreny='USD', (column(1)-column(2))/column(2)>0,green(),red())
or
If(curreny<>'USD', (column(1)-column(2))/column(2)>0,green(),red())
I need to get this right.
Currently the if statement I have works when currency selection is not USD but when I select 'USD' the color representation is wrong
This doesn't look like it's valid Qlik syntax. Your if() statement has four arguments and Qlik only accepts three- if(Condition,Then,Else).
What exactly are you trying to achieve?
If(curreny='USD' and (column(1)-column(2))/column(2)>0,green(),red())
This would be the syntax, did you just send an example? it looks like = USD & <> USD both have the same logic so you must want to do something different if you are trying to split them out.
If(curreny='USD',
If((column(1)-column(2))/column(2)>0,green(),red())
,If(curreny<>'USD', If((column(1)-column(2))/column(2)>0,green(),red())
)
I need below statement if currency selected is USD
( sum(distinct{<Price= {'Current'}>} sales_USD))-( sum(distinct{<Price= {'Launch'}, Date= , MonthYear=>} sales_USD))
/
( sum(distinct{<Price= {'Launch'}, Date= , MonthYear=>} sales_USD))>0, green(),red())
if currency selected is EUR
( sum(distinct{<Price= {'Current'}>} sales))-( sum(distinct{<Price= {'Launch'}, Date= , MonthYear=>} sales))
/
( sum(distinct{<Price= {'Launch'}, Date= , MonthYear=>} sales))
>0,green(),red())
May be something like this ( ensure expressions are properly formatted) -
Pick(Match(Currency,'USD','EUR'),
( sum(distinct{<Price= {'Current'}>} sales_USD))-( sum(distinct{<Price= {'Launch'}, Date= , MonthYear=>} sales_USD))
/
( sum(distinct{<Price= {'Launch'}, Date= , MonthYear=>} sales_USD))>0, green(),red()),
( sum(distinct{<Price= {'Current'}>} sales))-( sum(distinct{<Price= {'Launch'}, Date= , MonthYear=>} sales))
/
( sum(distinct{<Price= {'Launch'}, Date= , MonthYear=>} sales))
>0,green(),red())
)
I think you missed 'If' before your expression.
Pick(Match(Currency,'USD','EUR'),
if(( sum(distinct{<Price= {'Current'}>} sales_USD))-( sum(distinct{<Price= {'Launch'}, Date= , MonthYear=>} sales_USD))
/
( sum(distinct{<Price= {'Launch'}, Date= , MonthYear=>} sales_USD))>0, green(),red()),
if(( sum(distinct{<Price= {'Current'}>} sales))-( sum(distinct{<Price= {'Launch'}, Date= , MonthYear=>} sales))
/
( sum(distinct{<Price= {'Launch'}, Date= , MonthYear=>} sales))
>0,green(),red())
)