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

Multiple Expressions

I have an expression, =SUM(if([Trans Date]=(nwEVENTDTE-0), [Net Sold Qty]))

and I would like to add in another expression here where promoCDE=ADULT

What would the proper structure of this be?

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Maybe using boolean operator AND?

=SUM(if([Trans Date]=(nwEVENTDTE-0) and promoCDE = ADULT, [Net Sold Qty]))


If ADULT is not a field name, but a literal:


=SUM(if([Trans Date]=(nwEVENTDTE-0) and promoCDE = 'ADULT', [Net Sold Qty]))



View solution in original post

4 Replies
swuehl
MVP
MVP

Maybe using boolean operator AND?

=SUM(if([Trans Date]=(nwEVENTDTE-0) and promoCDE = ADULT, [Net Sold Qty]))


If ADULT is not a field name, but a literal:


=SUM(if([Trans Date]=(nwEVENTDTE-0) and promoCDE = 'ADULT', [Net Sold Qty]))



swuehl
MVP
MVP

There are also more advanced options to filter your data set, like set analysis, but start simple:

Conditional Aggregations

A Primer on Set Analysis

evansabres
Specialist
Specialist
Author

ADULT was a literal, thank you.

vishsaggi
Champion III
Champion III

Try this?

In your previous thread with set analysis question you are trying to compare [Trans Date] = (nwEVENTDTE -1)

Here when ever you subtract a date field with an integer you will get an integer as a result so for example if you do nwEVENTDTE-1 gives you some number like 45655 which is not equal to your Trans Date so we have to explicitly format the number to Date. For the below you don't need 0 to subtract. Hope this makes sense.

=SUM(if([Trans Date]= nwEVENTDTE AND promoCDE = 'ADULT', [Net Sold Qty]))


OR


= SUM( {< YourkeyID = { " = [Trans Date] = nwEVENTDTE" }, promoCDE = {'ADULT'}  >} [Net Sold Qty])