Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
thomas_2583
Contributor III
Contributor III

IF and AND Statement

Hi, 

I have an error within my expression, any idea how to correct please?

if(match(Year = '2018' and Type = 'New'), '0.48',
if(match(Year = '2019' and Type = 'Used'), '0.33',
if(match(Year = '2018' and Type = 'New'), '0.52',
if(match(Year = '2019' and Type = 'Used'), '0.66'))))

Thanks

1 Solution

Accepted Solutions
Vegar
MVP
MVP

Why are you using match()? Match takes two parameters.

 

Try this:

if((Year = '2018' and Type = 'New'), '0.48',
  if((Year = '2019' and Type = 'Used'), '0.33',
    if((Year = '2018' and Type = 'New'), '0.52',
      if((Year = '2019' and Type = 'Used'), '0.66')
    )
  )
)

View solution in original post

4 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

I think you mean if(match(Year = '2018') and Type = 'New', '0.48', if(match(Year = '2019') and Type = 'Used', '0.33', if(match(Year = '2018') and Type = 'New', '0.52', if(match(Year = '2019') and Type = 'Used'), '0.66')))
Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
jonathandienst
Partner - Champion III
Partner - Champion III

Sorry the format options are missing and the white spaces are being ignored
Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
thomas_2583
Contributor III
Contributor III
Author

Thanks for the suggestion but the logic doesn't appear to work. I'm not too sure what is meant by your latest comment, sorry?

Vegar
MVP
MVP

Why are you using match()? Match takes two parameters.

 

Try this:

if((Year = '2018' and Type = 'New'), '0.48',
  if((Year = '2019' and Type = 'Used'), '0.33',
    if((Year = '2018' and Type = 'New'), '0.52',
      if((Year = '2019' and Type = 'Used'), '0.66')
    )
  )
)