Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Coming your way, the Qlik Data Revolution Virtual Summit. October 27-29. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator
Creator

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
Highlighted

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?

Highlighted

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

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

Highlighted
Creator
Creator

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

Highlighted

Yes, Have you tried my expression

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

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

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