Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
dimak123
Partner - Contributor III
Partner - Contributor III

Count items for invoice

Good day,

need some help with aggregations:

I want to show a list of clients and to see how many invoices(just count) contained only one item, 2 items, 3 items and 4.

this is my data:

  

CustomerIdInvoiceIdInvoiceLineItemIdQuantity
10023701390082_INV3106920162
10023701390082_INV4106920161
10023701390082_INV5106920162
10023701390082_INV6106920162
10023701390082_INV7106920162
10023701390082_INV8106920162
10008301390090_INV1102810044
10008301390090_INV2106920161
10008301390090_INV3102810042
10008301390090_INV4102810042
10008301390090_INV5102810041
10008301390090_INV6102810044
10008301390090_INV7102810044

many thanks a head

13 Replies
MayilVahanan

Hi

Try like this

Customer, Invoice Id as dimension

Count(distinct ItemId) as Measure

So that you can able to find, each invoices has how many item count.

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
dimak123
Partner - Contributor III
Partner - Contributor III
Author

i need to show i my final table only clients and counts , without invoices

MayilVahanan

Hi

Could you please say the output how you expected for the sample data.

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
dimak123
Partner - Contributor III
Partner - Contributor III
Author

my expected result

CustomerId

1 item for Invoice2 items for Invoice3 items for Invoice4 items for Invoice
10023710541
10008315721
PradeepReddy
Specialist II
Specialist II

see the attachment, it might be helpful for you..

dimak123
Partner - Contributor III
Partner - Contributor III
Author

thank you, but the itemid doesn't really matter only the Quantity field

PradeepReddy
Specialist II
Specialist II

how you are calculating  '1 item for Invoice' as  10 for customer ID=100237?

dimak123
Partner - Contributor III
Partner - Contributor III
Author

the numbers i put its not real

just the structure

sasikanth
Master
Master

hi ,

please find the attachment ,

seems your expected output is wrong according to the sample data