Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Count tickets that only buy one product

How can I count how many tickets that have only bought one product? And nothing else.

HI. I have a Fact table with products and checknumber that customer have bought. How can I count how many tickets that have only bought the selected product(s) and nothing else.

Thanks

***************     UPDATE     ***************

I have the following fields:

BusinessUnitID, Date, CheckNumber, Product, Sales, Quantity

     Ticket 178 must be counted because only has one product

     Ticket 5799 has more than one product and doesnt be counted

Im need to count tickets where only appear product 863023.

Thanks again

6 Replies
Peter_Cammaert
Partner - Champion III
Partner - Champion III

Do you want to count the tickets that bought just a single product and that product must be in a specific selection/list, or do you want to count tickets that only bought products from a specific selection but the total number is not important?

Anil_Babu_Samineni

1) How can I count how many tickets that have only bought one product? And nothing else.

Count({$<Prouct = {'Product Name'}>}Ticket)

Can you explain second one

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
neelamsaroha157
Specialist II
Specialist II

Try this

=Count({$<Ticket=P({1<Customer={$(=Count(Total <Customer> Product) =1)}>}Customer)>}Ticket)

This first counts the Total number of products that a customer bought and returns those customer if count=1(who bought only 1 product) and then count the number of Tickets for those who bought only one product.

Hope this helps

Anonymous
Not applicable
Author

I need to count the tickets that bought just a single product p.e Product 864520

Anil_Babu_Samineni

Yes, Have you tried my expression

Count({<product = {'864520'}>} tickets)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Peter_Cammaert
Partner - Champion III
Partner - Champion III

If you select the product(s) you want to count tickets for in a list box, then you could use an expression like this:

=count({<ticketno *= {"=count({1} DISTINCT Product) = 1"}>} ticketno)

I used imaginary field names because your OP didn't mention actual fields. Replace them where necessary.

Also don't mind the syntax error that the expression editor reports on the *= operator. The operator is ok, but the syntax checker doesn't now that (yet).

Best,

Peter