Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Zurich on Sept 24th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Counting articles separately

Customers can order the Articles JACK01, JACK02, JACK03, JACK04 seperatly. I want to make an overvieuw of the amount of customers who have ordered all 4 of the articles. When I make a substringcount of the below expression, it only shows ‘1’ Are there any ideas what to do? Thanks a lot!

= SubStringCount( if(sum({$}(ORDER_QTY))>0, '1')

+ if(sum({$}(ORDER_QTY))>0, '1')

+ if(sum({$}(ORDER_QTY))>0, '1')

+ if(sum({$}(ORDER_QTY))>0, '1') ,4 )

1 Solution

Accepted Solutions
hic
Former Employee
Former Employee

I would do something similar to

Count({$<CustomerID=

  P({$<Article={JACK01}>} CustomerID)*

  P({$<Article={JACK02}>} CustomerID)*

  P({$<Article={JACK03}>} CustomerID)*

  P({$<Article={JACK04}>} CustomerID)

  >}

  distinct CustomerID)

I.e. use set analysis to pick out the possible customers. The four P() functions return the possible customers for each of the articles, and these are then "multiplied" with each other to form the intersection.

HIC

View solution in original post

3 Replies
lironbaram
Partner - Master III
Partner - Master III

you can try something like

sum(aggr(if(count({<ORDER_QTY={">0"}>}distinct Article)=4,1,0),ClientID))

hic
Former Employee
Former Employee

I would do something similar to

Count({$<CustomerID=

  P({$<Article={JACK01}>} CustomerID)*

  P({$<Article={JACK02}>} CustomerID)*

  P({$<Article={JACK03}>} CustomerID)*

  P({$<Article={JACK04}>} CustomerID)

  >}

  distinct CustomerID)

I.e. use set analysis to pick out the possible customers. The four P() functions return the possible customers for each of the articles, and these are then "multiplied" with each other to form the intersection.

HIC

Not applicable
Author

Thank you very much! This answered worked flawlessly.