# QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

cancel
Showing results for
Did you mean:
Creator

## Count distinct if Sum > amount

Hello,

I have a table of lines of invoices (invoice number - date - client - item - quantity).

I need to count the invoice numbers where the total amount ordered for all items is below 10 kg.  The count will be shown in a table by client.

CHRONOFA = the invoice number

TONNAGE VENDU = quantity

I've tried :

=count(distinct aggr ( if (sum([TONNAGE VENDU])<10, CHRONOFA) , CHRONOFA))

but its not giving me the right number.

I've also tried :

=Count(DISTINCT {<CHRONOFA = {"=Sum([Tonnage_Vendu]) < 10"}>} CHRONOFA)

Any ideas anyone??

Thanks!

Labels (2)

• ### Distinct values

1 Solution

Accepted Solutions
Creator
Hi,
Can you try this..

=Sum(IF(Aggr(sum([TONNAGE VENDU]),CHRONOFA) < 10,1))
4 Replies
Contributor III

Creator
Author

Per client, I want to count the distinct invoice numbers (field CHRONOFA) when the total sum of the quantity (field [TONNAGE VENDU]) is under 10.

I'm not sure I'm actually replying to  your question...  could you be more specific in what details you are interested in ?

Creator
Hi,
Can you try this..

=Sum(IF(Aggr(sum([TONNAGE VENDU]),CHRONOFA) < 10,1))
Creator
Author

Yes!  This worked great!   Thanks for your help!