Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

If function with two clauses from different tables (In chart)

Hi

I'm trying to make a simple Sum function, which should be dependent on two "IF" clauses, but for some reason I can't make it work...

The function below should take the sum of [Sales Lines - Net Sales Amount], but only for the lines, which doesn't have either status None from table Sales Line - A or status Cancelled from table Sales Line - B

sum(if([Sales Lines - A] <> 'None' OR [Sales Lines - B] <> 'Cancelled', [Sales Lines - Net Sales Amount]

))

Any ideas?

I also tried to put this data into my script (since I'll be using this variable several times), but I was unsuccesful (Read: Not skilled enough 😉 )

Looking forward to hear from you

1 Solution

Accepted Solutions
MayilVahanan

HI

Try like this

= Sum({<[Sales Lines - A] -={'None'}, [Sales Lines - B] -= {'Cancelled'}> }[Sales Lines - Net Sales Amount])

Hope that helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

2 Replies
MayilVahanan

HI

Try like this

= Sum({<[Sales Lines - A] -={'None'}, [Sales Lines - B] -= {'Cancelled'}> }[Sales Lines - Net Sales Amount])

Hope that helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Anonymous
Not applicable
Author

Thank you Mayil

That did exactly what I was looking for.

I didn't know the sum function could be used the way you just did, thanks.