Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Simple If statement

Hello;

        I need to build out a simple if statement, but I am having issues and don't see where my error could be, I have to continue to December but I cant get this to work, can anyone see where my error is?

=

(

if([Ops Month], 'Jan', 'Revenue 56M of Goal 53M'),

if([Ops Month], 'Feb', 'Revenue 56M of Goal 53M'),

if([Ops Month], 'Mar', 'Revenue 56M of Goal 53M'),

if([Ops Month], 'Apr', 'Revenue 56M of Goal 53M'),

'Other'

)

1 Solution

Accepted Solutions
simospa
Partner - Specialist
Partner - Specialist

Hi,

it's wrong the nesting

Try this:

( //useless parenthesis ?

if([Ops Month]= 'Jan', 'Revenue 56M of Goal 53M',

if([Ops Month]= 'Feb', 'Revenue 56M of Goal 53M',

if([Ops Month]= 'Mar', 'Revenue 56M of Goal 53M',

if([Ops Month]= 'Apr', 'Revenue 56M of Goal 53M',

'Other'))))

) //useless parenthesis?

Simone

View solution in original post

6 Replies
vamsee
Specialist
Specialist

Can you please explain the condition in words, as above syntax is not appropriate.

IF( Condition  , True, If( Condition , True) )


https://help.qlik.com/en-US/qlikview/November2017/Subsystems/Client/Content/Scripting/ConditionalFun...


Hope this helps.

simospa
Partner - Specialist
Partner - Specialist

Hi,

it's wrong the nesting

Try this:

( //useless parenthesis ?

if([Ops Month]= 'Jan', 'Revenue 56M of Goal 53M',

if([Ops Month]= 'Feb', 'Revenue 56M of Goal 53M',

if([Ops Month]= 'Mar', 'Revenue 56M of Goal 53M',

if([Ops Month]= 'Apr', 'Revenue 56M of Goal 53M',

'Other'))))

) //useless parenthesis?

Simone

neelamsaroha157
Specialist II
Specialist II

if([Ops Month], 'Jan', 'Revenue 56M of Goal 53M',

if([Ops Month], 'Feb', 'Revenue 56M of Goal 53M',

if([Ops Month], 'Mar', 'Revenue 56M of Goal 53M',

if([Ops Month], 'Apr', 'Revenue 56M of Goal 53M',

'Other'

))))

Anonymous
Not applicable
Author

Hello and thank you for the reply.

I have a selection of month and based on the selection I want the script to pop up, so if they select Jan then i want the phrase 'Revenue 123M of Goal 123M' to be displayed

neelamsaroha157
Specialist II
Specialist II

Also, I am not sure why are you using 4 IFs when you want to return the same value for all. I would suggest something like this -

If(Match([Ops Month], 'Jan', 'Feb','Mar','Apr'), 'Revenue 56M of Goal 53M', 'Other')

vamsee
Specialist
Specialist

You will be able to achieve this in a single IF statement.

IF( Match(([Ops Month],  'Jan', 'Feb', 'Mar', 'Apr'), 'Revenue 123M of Goal 123M', 'Other')