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

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

how to get this count

Hi All,

there is requirement where I need to calculate Orders who have only pen and pencil under that order..

for example below is my data set:

Load * inline

[

OrderID,ProductType

1,pen

1,pencil

1,paper

2,pen

2,pencil

3,rubber

3,pen

3,pencil

];

Now in the above case if I want to calculate count of orderID for only pen and pencil then it should come = 1

how to solve this problem.

Thanks in advance

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try =count({<OrderID=E({<ProductType-={'pen','pencil'}>}OrderID)>}distinct OrderID)


talk is cheap, supply exceeds demand

View solution in original post

6 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Perhaps

Count(Distinct Aggr(If(Concat(ProductType) = 'penpencil' Or Concat(ProductType) = 'pencilpen', OrderID), OrderID))

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try =count({<OrderID=E({<ProductType-={'pen','pencil'}>}OrderID)>}distinct OrderID)


talk is cheap, supply exceeds demand
anbu1984
Master III
Master III

=Count(DISTINCT {<OrderID=E({< ProductType -= {'pen','pencil'}>}) >} OrderID)

Or

=Count(DISTINCT OrderID) - Count(DISTINCT {< ProductType -= {'pen','pencil'} >} OrderID)

ankit777
Specialist
Specialist

You  can use:

==if(Concat(ProductType,'')='penpencil' or Concat(ProductType,'')='pencilpen',count(distinct OrderID))

sushil353
Master II
Master II

Hi,

Try this one:

=Count(Distinct OrderID)-Count(Distinct {<ProductType = e({<ProductType = {'pen','pencil'}>} ProductType)>} OrderID)

HTH

Sushil

maxgro
MVP
MVP

in a text box

=sum(aggr(if(count({$ <ProductType={pen,pencil}>} distinct ProductType)=count(DISTINCT ProductType),1,0),OrderID))

in a chart with order id as dimension

if(count({$ <ProductType={pen,pencil}>} distinct ProductType)=count(DISTINCT ProductType),1,0)