Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
fabricecallegar
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 ?

1 Solution

Accepted Solutions
jagan
Luminary Alumni
Luminary Alumni

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
Master III
Master III

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

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try this expression using Aggr()

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

Hope this helps you.

Regards,

Jagan.

fabricecallegar
Partner - Creator
Partner - Creator
Author

no, I would like to have :

A1 : 1

A2 : 2

fabricecallegar
Partner - Creator
Partner - Creator
Author

thank you Jagan but it doesn't work :

qv3.gif

jagan
Luminary Alumni
Luminary Alumni

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

fabricecallegar
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