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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Counting Buyers

Hi all,

I'm trying to count how many buyers that have bought less than 300 units within the last 12 months.

Below is my expression but it isn't working, any help would be greatly appreciated. buyer b.no is the buyers id number.

count( DISTINCT if(  sum(

  {< UNIT.STOCKSTATUS={'sold'},

  SOLD.YrMthSeq= {"<=$(=$(vRptYrMthSeqTY) -0) >=$(=$(vRptYrMthSeqTY) -11)"},

  BUYER.B_IND_CAT = {'CS'} >} UNIT.TOTALSOLD) < 300,

  BUYER.B_NO))

Thanks

Gareth

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try

count({<BUYER.B_NO = {"=sum(  {< UNIT.STOCKSTATUS={'sold'},

  SOLD.YrMthSeq= {'<=$(=$(vRptYrMthSeqTY) -0) >=$(=$(vRptYrMthSeqTY) -11)'},

  BUYER.B_IND_CAT = {'CS'} >} UNIT.TOTALSOLD) < 300  "}>} DISTINCT  BUYER.B_NO)


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try

count({<BUYER.B_NO = {"=sum(  {< UNIT.STOCKSTATUS={'sold'},

  SOLD.YrMthSeq= {'<=$(=$(vRptYrMthSeqTY) -0) >=$(=$(vRptYrMthSeqTY) -11)'},

  BUYER.B_IND_CAT = {'CS'} >} UNIT.TOTALSOLD) < 300  "}>} DISTINCT  BUYER.B_NO)


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

Brilliant thank you Gysbert!