Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
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

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
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)

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
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