Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
realpixel
Creator
Creator

SUM IF

Hello,

I have the following expression

=sum(if((IDEFAC='L'),MFAC))

It's works fine, now I want to add for value IDEFAC 'L' and  'N' and 'S' and 'F'

I try this expression

=sum(if((IDEFAC='L' and IDEFAC='N' and IDEFAC='S' and IDEFAC='F'),MFAC)) but it's not works

Someone have an idea?

1 Solution

Accepted Solutions
Clever_Anjos
Employee
Employee

But if you insist using IF

=sum(if((IDEFAC='L' OR IDEFAC='N' OR IDEFAC='S' OR IDEFAC='F'),MFAC))

View solution in original post

6 Replies
Clever_Anjos
Employee
Employee

Maybe using Set Analysis makes things easier

=sum({<IDEFAC={'L','N','S','F'>}MFAC))

Clever_Anjos
Employee
Employee

But if you insist using IF

=sum(if((IDEFAC='L' OR IDEFAC='N' OR IDEFAC='S' OR IDEFAC='F'),MFAC))

MK_QSL
MVP
MVP

SUM({<Customer_Name = {'A','B','C','D'}>}QTY)

MayilVahanan

Hi

Try like this

=sum({<IDEFAC={'L','N','S','F'>} MFAC) // or function

or

=sum({<IDEFAC={'L'}> * <IDEFAC={'N'}> * <IDEFAC={'S'}> * <IDEFAC={'F'}>} MFAC) // And Function

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

Thank you Clever,

Expression under works fine

=sum(if((IDEFAC='L' OR IDEFAC='N' OR IDEFAC='S' OR IDEFAC='F'),MFAC))

MK_QSL
MVP
MVP

FYI .... IF is much slower compare to SET ANALYSIS.