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

Announcements
Join us in Zurich on Sept 24th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

set analysis with if

hello

i have a field with values greater and less than 0.

so, i need to make a set analysis where if the value of A is greater than 0 is sum with a field B, and if it's less than 0 is sum with a field C.

Thanks.

2 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

No need for an if statement:

Sum({<A = {">0"}>} B) + Sum({<A = {"<0"}>} C)

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

You don't seem to ask a question in your post, but based on the subject I assume you want to know how to do a conditional sum?

Set analysis limits (or extends) the set of data the formula is working on, so that's not the way to go here. If is the function you want:

=SUM(IF(FieldA>0,FieldB,FieldC))

This wil check the value of Field A for each record and if it is greater than 0 it will add FieldB to the total sum, else Field C

Hope that answers the question you didn't ask