Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
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

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

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!