Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

eustisab
New Contributor III

count if multiple dimension

Hi Everyone,

Please help.

I'm trying to count those ID Conversations that were answered within 30seconds.

count id conversations if [tAnswered]<=30 and [nAnswered] =1

    sample.JPG

I just do not know how to insert the [nAnswered] condition on the below.

Count({<[Aggr tAnswered]={'<=30'}>}Distinct [ID: Conversation])

1 Solution

Accepted Solutions
pradosh_thakur
Honored Contributor II

Re: count if multiple dimension

Hi Isabel

try this


Count( Distinct {<[Aggr tAnswered] ={"=sum([Aggr tAnswered])/1000<=30"},[Aggr nAnswered] ={1}>} [ID: Conversation])



or


sum(If([Aggr tAnswered]<=30 and [Aggr nAnswered] =1,1,0))

Learning never stops.
12 Replies
luismadriz
Valued Contributor

Re: count if multiple dimension

HI Isabel,

Please try this:

Count( Distinct {<tAnaswered={"<=30"},nAnswered={1} >} [ID: Conversation])


I hope this helps,


Luis

eustisab
New Contributor III

Re: count if multiple dimension

I do not know the reason why it is counting 32.38 . It should be 0

wrong.JPG

luismadriz
Valued Contributor

Re: count if multiple dimension

But if you only want it in a table like you have in the post then you just need a calculated one:

If(tAnaswered<=30 and nAnswered=1,1,0)


If you need it as a KPI then this should do:

Count( Distinct {<tAnaswered={"<=30"},nAnswered={1} >} [ID: Conversation])


I hope this helps,


Luis

luismadriz
Valued Contributor

Re: count if multiple dimension

I think it's because 32.38 comes from a Sum, and you seem to be trying to use the direct value

eustisab
New Contributor III

Re: count if multiple dimension

If(tAnaswered<=30 and nAnswered=1,1,0)

this returns everything to 0.


wrong.JPG2.JPG

eustisab
New Contributor III

Re: count if multiple dimension

hmmm

Count( Distinct {<[Aggr tAnswered/1000] ={"<=30"},[Aggr nAnswered] ={1}>} [ID: Conversation])

how can I insert sum function here? I should sum the tAnswered

luismadriz
Valued Contributor

Re: count if multiple dimension

You're not comparing it correctly as you're displaying Sum(tAnaswered) but then using the field without aggregation in your IF

luismadriz
Valued Contributor

Re: count if multiple dimension

Please see if this example helps you:

Untitled.png

Please let me know,

Cheers,

Luis

Edited: changed data as two rows were clubbed together

pradosh_thakur
Honored Contributor II

Re: count if multiple dimension

Hi Isabel

try this


Count( Distinct {<[Aggr tAnswered] ={"=sum([Aggr tAnswered])/1000<=30"},[Aggr nAnswered] ={1}>} [ID: Conversation])



or


sum(If([Aggr tAnswered]<=30 and [Aggr nAnswered] =1,1,0))

Learning never stops.
Community Browser