Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

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
MVP
MVP

Re: Combining 'if' and 'sum'

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
MVP
MVP

Re: Combining 'if' and 'sum'

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

arulsettu
Honored Contributor III

Re: Combining 'if' and 'sum'

try like this

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

MVP & Luminary
MVP & Luminary

Re: Combining 'if' and 'sum'

Hi,

Best method using Set Analysis without if

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


Regards,

Jagan.

Not applicable

Re: Combining 'if' and 'sum'

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.

MVP & Luminary
MVP & Luminary

Re: Combining 'if' and 'sum'

Hi,

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

Regards,

jagan.

Re: Combining 'if' and 'sum'

Set expressions should perform better

Not applicable

Re: Combining 'if' and 'sum'

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