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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
ecabanas
Creator II
Creator II

how to do 'count like'

Hi

I have a table with

SALES:

salesid

pv000001

pv000002

pv900001

I Want to count only that begins with "pv00" 

LOAD

          COUNT(DISTINCT SALESID) AS CONTADOR_COMPRAS,

          CUSTACCOUNT AS CUSTACCOUNT_CONTADOR,

 

          if(COUNT(DISTINCT SALESID) >= 0 and COUNT(DISTINCT SALESID) <= 2, '1-2',

     if(COUNT(DISTINCT SALESID) >= 3 and COUNT(DISTINCT SALESID) <= 4, '3-4',

     if(COUNT(DISTINCT SALESID) >= 5 and COUNT(DISTINCT SALESID) <= 10, '5-10',

     if(COUNT(DISTINCT SALESID) >= 11 and COUNT(DISTINCT SALESID) <= 20, '11-20',

     if(COUNT(DISTINCT SALESID) >= 21 and COUNT(DISTINCT SALESID) <= 30, '21-30',    

     if(COUNT(DISTINCT SALESID) >= 31 and COUNT(DISTINCT SALESID) <= 40, '31-40',    

     if(COUNT(DISTINCT SALESID) >= 41 and COUNT(DISTINCT SALESID) <= 50, '41-50',         

     if(COUNT(DISTINCT SALESID) >= 51 and COUNT(DISTINCT SALESID) <= 60, '51-60',    

     if(COUNT(DISTINCT SALESID) >= 61, '60+'))))))))) as Classification

    RESIDENT SALESTABLE

    WHERE CREATEDDATETIME <='$(vminmonth)'

    GROUP BY CUSTACCOUNT;

thanks!!!!

Eduard

1 Solution

Accepted Solutions
er_mohit
Master II
Master II

i think you have to put another  where condition for salesid i.e

if your above script is Working then you need only this

  RESIDENT SALESTABLE

    WHERE CREATEDDATETIME <='$(vminmonth)' and wildmatch(Salesid,'pv00*')

    GROUP BY CUSTACCOUNT;

View solution in original post

4 Replies
Not applicable

Load new table...resident firsttable;then do GROUP BY

ecabanas
Creator II
Creator II
Author

is grouping now... I group by usserID  i want to count the number os sales from a customer, but only the orders with PV00  not PV9

er_mohit
Master II
Master II

i think you have to put another  where condition for salesid i.e

if your above script is Working then you need only this

  RESIDENT SALESTABLE

    WHERE CREATEDDATETIME <='$(vminmonth)' and wildmatch(Salesid,'pv00*')

    GROUP BY CUSTACCOUNT;

ecabanas
Creator II
Creator II
Author

tHANK YOUUUUUUU GREAT!!!