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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
KellyMc
Contributor
Contributor

How to I sum one column ONLY when another column is NOT NULL

I have a table with month, category, ACTUAL Revenue, and PROJECTED Revenue as variables. The Actual revenues are populated only for year-to-date (by month) so when I sum them, I get the Actual YTD revenue. 

I want to calculate the YTD Projected Revenue by counting ONLY the monthly projected revenue values where the matching Actual Revenue value is NOT NULL.

I tried doing this multiple times and thought the following expression would work, but it's returning zero.

=sum({<Actual={'>0'}>} Projection)

Labels (1)
1 Solution

Accepted Solutions
tresesco
MVP
MVP

Try like:

=sum({<Actual={">0"}>} Projection)                     // double quotes for greater than zero

Or,

=sum({<Actual={"*"}>} Projection)                       // for not null

View solution in original post

1 Reply
tresesco
MVP
MVP

Try like:

=sum({<Actual={">0"}>} Projection)                     // double quotes for greater than zero

Or,

=sum({<Actual={"*"}>} Projection)                       // for not null