Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Multiple If Statements

I have the need to add a condition to a report.  Currently there are multiple conditions on the report but for one of the fields I need to add another status type.

Currently it looks like this.

sum({<[Transaction Status] = {'Request Completed'},[Transaction Sold Flag]={'N'},[Active Flag]={'Active'}>}USD)

I need to also include the Transaction status of Held, could I just do this?

sum({<[Transaction Status] = {'Request Completed'},[Transaction Status] = {'Held'},[Transaction Sold Flag]={'N'},[Active Flag]={'Active'}>}USD)

1 Solution

Accepted Solutions
Not applicable
Author

Hi Jason,

yes, you can.

if you'll find any difficulties with set analysis then try with normal if condition with "or" function.

View solution in original post

6 Replies
swuehl
MVP
MVP

Try

sum({<[Transaction Status] = {'Request Completed','Held'}, [Transaction Sold Flag]={'N'},[Active Flag]={'Active'}>}USD)

Clever_Anjos
Employee
Employee

sum({<[Transaction Status] = {'Request Completed','Held'},[Transaction Sold Flag]={'N'},[Active Flag]={'Active'}>}USD)

Not applicable
Author

Hi Jason,

yes, you can.

if you'll find any difficulties with set analysis then try with normal if condition with "or" function.

swuehl
MVP
MVP

I don't think that your expression

sum({<[Transaction Status] = {'Request Completed'},[Transaction Status] = {'Held'},[Transaction Sold Flag]={'N'},[Active Flag]={'Active'}>}USD)


will consider both transaction status values, I believe there should be only one field selection per set modifier (i.e. only a one time appearance of [Transaction Status] = ... within <....> ).


Have you tried your expression? And have you tried a field selection with an element set {'Request Completed','Held'} ?

evan_kurowski
Specialist
Specialist

Agree with swuehl, who's syntax appears valid the first time.  This 'correct' answer needs an NFL's coach's review flag.

Not applicable
Author

LOL, love that the challenge flag just got thrown in on a QlikView community thread. 

I will play with the data and see how it works with both.  I added the statement that I had first entered in and the data never changed, after further review I found deep in the script that the value 'N" for Transaction Sold Flag is set to N if the Transaction Status is 'Held', so the request from the user was redundant.

Which is why when I entered the new syntax in the results didn't change.  Either way I will play with some data and get back to the thread and see which way works, maybe both do.