Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Leverage your QlikView investment to modernize BI – see how! Join Group
cancel
Showing results for 
Search instead for 
Did you mean: 
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
Highlighted

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

View solution in original post

7 Replies
Highlighted

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

View solution in original post

Highlighted
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'))

Highlighted
Champion
Champion

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'))

Highlighted
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?

Highlighted
Champion
Champion

Re: Nested IF Statement Help

Go to Visual Cues of your reports object

and set the color like Text/Backgroud etc..

PFA

Highlighted
Champion
Champion

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..

Highlighted
Not applicable

Re: Nested IF Statement Help

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

cues.png