Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
Highlighted
Not applicable

Nested IF Statement Help

Hi,

I am having trouble with a nested IF statement;

I'm getting an error of "Error in expression, if takes 2-3 parameters"

The query below has 2 clear statements and an alternative outcome so I'm not sure why this fails. Can someone advise where I am going wrong?

=IF((Team = 'West Ham' and Result = 'Home Win' and IsHomeTeam = 'Yes')
OR (Team = 'West Ham' and Result = 'Away Win' and IsHomeTeam = 'No'),'W',
IF(Team = 'West Ham' and Result = 'Draw'),'D',
'L')

1 Solution

Accepted Solutions

Re: Nested IF Statement Help

Try with

=IF((Team = 'West Ham' and Result = 'Home Win' and IsHomeTeam = 'Yes')
OR (Team = 'West Ham' and Result = 'Away Win' and IsHomeTeam = 'No'),'W',
IF(Team = 'West Ham' and Result = 'Draw','D',
'L') )

let me know

7 Replies

Re: Nested IF Statement Help

Try with

=IF((Team = 'West Ham' and Result = 'Home Win' and IsHomeTeam = 'Yes')
OR (Team = 'West Ham' and Result = 'Away Win' and IsHomeTeam = 'No'),'W',
IF(Team = 'West Ham' and Result = 'Draw','D',
'L') )

let me know

MVP
MVP

Re: Nested IF Statement Help

IF( (Team = 'West Ham' and Result = 'Home Win' and IsHomeTeam = 'Yes') OR (Team = 'West Ham' and Result = 'Away Win' and IsHomeTeam = 'No'), 'W',

IF( (Team = 'West Ham' and Result = 'Draw' ), 'D',

'L'))

balrajahlawat
Esteemed Contributor

Re: Nested IF Statement Help

Try this:


Misiing brackets..


=IF(((Team = 'West Ham' and Result = 'Home Win' and IsHomeTeam = 'Yes')

       OR (Team = 'West Ham' and Result = 'Away Win' and IsHomeTeam = 'No')),'W',
IF((Team = 'West Ham' and Result = 'Draw'),'D','L'))

Not applicable

Re: Nested IF Statement Help

Many thanks guys, it's always a missing bracket!

Can you advise now this IF statement works how I would use the Visual Cues to make the expression background Green for a W, Red for an L and Grey for a D?

balrajahlawat
Esteemed Contributor

Re: Nested IF Statement Help

Go to Visual Cues of your reports object

and set the color like Text/Backgroud etc..

PFA

balrajahlawat
Esteemed Contributor

Re: Nested IF Statement Help

Select your expression name in you Visual Cues properties of Reports from top left,

and apply cues as per ur reqs..

Not applicable

Re: Nested IF Statement Help

I've set the following up, but it does not work?

cues.png