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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
fabricecallegari
Partner - Creator
Partner - Creator

set analysis formula

Hi,

I need your help to create a fromula.

I have this data :

data.gif

I want to know how many distinct tickets available by attribut with the special condition : if the sum of qty by ticket must be different than 0, else the ticket is not taken.

So the results must be :

A1 : 1 (ticket T2)

A2 : 2 (ticket T1 and T2)

In fact, I want the sum of the third column by attributs :

qv1.gif

and when I remove "Tick" the results are false;

qv2.gif

Any ideas ?

Labels (1)
1 Solution

Accepted Solutions
jagan
Partner - Champion III
Partner - Champion III

Hi,

Please find attached file for solution.

I used this expression, it is working.

=Sum(Aggr(If(Sum(qty) = 0, 0, 1), tick, attribute))

Regards,

Jagan.

View solution in original post

8 Replies
robert_mika
MVP
MVP

So in your last example the last two 1  (under if(sum(Qty)...will be evaluated to 0?

jagan
Partner - Champion III
Partner - Champion III

Hi,

Try this expression using Aggr()

Sum(Aggr(If(Sum(Qty) = 0, 0, 1), Tick))

Hope this helps you.

Regards,

Jagan.

fabricecallegari
Partner - Creator
Partner - Creator
Author

no, I would like to have :

A1 : 1

A2 : 2

fabricecallegari
Partner - Creator
Partner - Creator
Author

thank you Jagan but it doesn't work :

qv3.gif

jagan
Partner - Champion III
Partner - Champion III

Hi,

Please find attached file for solution.

I used this expression, it is working.

=Sum(Aggr(If(Sum(qty) = 0, 0, 1), tick, attribute))

Regards,

Jagan.

maxgro
MVP
MVP

1.jpg

=count(distinct Aggr(If(Sum(q)=0, null(), t), t, a))

fabricecallegari
Partner - Creator
Partner - Creator
Author

thank a lot !

Not applicable

Hi Fabrice.

please see attached, another option for you which doesn't require nesting an if statement.

Hope that helps

Joe