Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

if condition does not work with multiple choices

Hi!

I have problem with an if statement.

i have a chart with invoicenumber as a dimension and in my expression i want it to give me a value if the invoices is connected to a bookkeeping account.

so in my case i write =if(bk_account='1401','Yes','No')

and it returns "No" even if the invoicinumber IS connected to a bk account.

The only thing i can come up with is that this has to be because there's several bk_accounts connected to the invoice.

Am i right? And in that case, how do i solve my problem?

Thanks in advance!

//A.

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Sorry, there is a mistake in my previous expression. please try this:

IF(Count(IF(bk_account=1401,'Yes'))>0,'Yes', 'No')

Regards, tresesco

View solution in original post

6 Replies
Not applicable
Author

Hi,

Can you attach the application?

Thanks & Regards

Jai

tresesco
MVP
MVP

there could be several options, try this:

IF(Count(IF(bk_account=1401,'Yes','No'))>0,'Yes', 'No') // somewhat like checking existance

does EXISTS() help otherwise?

Regards, tresesco

Not applicable
Author

if bk_account is a number you don't need the quotes around it

Not applicable
Author

i have to put the exists in the script right? because i do this in the expression in a chart...

the one you provided with the "count" didn't work unfortunately.

And also, i've tried with and witout the quotes around 1401.

tresesco
MVP
MVP

Sorry, there is a mistake in my previous expression. please try this:

IF(Count(IF(bk_account=1401,'Yes'))>0,'Yes', 'No')

Regards, tresesco

Not applicable
Author

Thanks! It worked!

/A.