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: 
Not applicable

If statement

I want to write an expression that sums the MLOA Total Days3 column for all instances where Placed Date1 >=5 and where DischargedDate2 >=1000.

If I do: if(Placed Date1>5 and DischargedDate2>=1000, sum(MLOA Total Days3). The only problem is that this way I would have to make selections under my PlacedDate1 and my DIschargedDate2 fields to get the graph to show me the data. I was wondering if there was a way where after I enter this script, the graph would automatically display the sum under these conditions, even if I hit the Clear button in QV.

Placed Date1Discharged Date2MLOA Total Days3
110012
220035
330098
440031
55007
66001
77002
88002
99000
1010002
1111002
12120024
1313000
1414001
1515002
1616000
1717000
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

instead of doing IF(CONDITION, SUM(FIELD)), try changing it to SUM(IF(CONDITION, FIELD))

View solution in original post

2 Replies
Anonymous
Not applicable
Author

instead of doing IF(CONDITION, SUM(FIELD)), try changing it to SUM(IF(CONDITION, FIELD))

Not applicable
Author

The sum(if(condition,field)) worked! Thank you!