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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
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
Partner - Champion III
Partner - Champion III

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
Partner - Champion III
Partner - Champion III

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