Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Combining 'if' and 'sum'

Can I combine an 'if' and a 'sum' statement within a gauge chart?  For example, if the office location = 'XXX' give me the sum of the Cases Closed Ontime  / Total Number of Cases.  At present, my expression reads...

=sum(TRCaseClosedOntimeCounter)/sum(TRJobCounter)

How do I build in the 'if' statement?

Thanks in advance.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Maybe like this:

=sum(if(Location = 'XXX', TRCaseClosedOntimeCounter))

/ sum(if(Location = 'XXX', TRJobCounter) )

or using set Analysis:

=sum({<Location = {'XXX'}>} TRCaseClosedOntimeCounter)/sum({<Location = {'XXX'}>}TRJobCounter)

 

View solution in original post

7 Replies
swuehl
MVP
MVP

Maybe like this:

=sum(if(Location = 'XXX', TRCaseClosedOntimeCounter))

/ sum(if(Location = 'XXX', TRJobCounter) )

or using set Analysis:

=sum({<Location = {'XXX'}>} TRCaseClosedOntimeCounter)/sum({<Location = {'XXX'}>}TRJobCounter)

 

arulsettu
Master III
Master III

try like this

if(office location = 'XXX' ,sum(TRCaseClosedOntimeCounter)/sum(TRJobCounter))

jagan
Luminary Alumni
Luminary Alumni

Hi,

Best method using Set Analysis without if

sum({<Location = {'XXX'}>}TRCaseClosedOntimeCounter)/sum({<Location = {'XXX'}>} TRJobCounter)


Regards,

Jagan.

Not applicable
Author

Thanks for the prompt responses. I'm still getting to grips with how formulas are constructed.

What's the difference between combining the 'if' and 'sum' statements and using Set Analysis?

Thanks again.

jagan
Luminary Alumni
Luminary Alumni

Hi,

Both methods work, but Set Analysis will have better performance.

Regards,

jagan.

MarcoWedel

Set expressions should perform better

Not applicable
Author

Thanks all... I've now set this up as a Set Analysis