Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have the following Scenario.
USER_ID, FIELD-A, FIELD-B, FIELD-C, FIELD-D
I am trying to count USER_ID if any of the FIELDS-A to FIELD-D has more than 0.
How do I count?
Thank you
count({<[FIELD-A]={'>0'}>+<[FIELD-B]={'>0'}>+<[FIELD-C]={'>0'}+<[FIELD-D]={'>0'} USER_ID)
count({<[FIELD-A]={'>0'}>+<[FIELD-B]={'>0'}>+<[FIELD-C]={'>0'}+<[FIELD-D]={'>0'} USER_ID)
Try this
A:
load
USER_ID, FIELD-A, FIELD-B, FIELD-C, FIELD-D
from table;
No Concatenate
load
count(if(FIELD-A>0 and FIELD-B>0 and FIELD-C>0 and FIELD-D>0,USER_ID)) as User_Count,
USER_ID, FIELD-A, FIELD-B, FIELD-C, FIELD-D
resident A;
Group by USER_ID, FIELD-A, FIELD-B, FIELD-C, FIELD-D;
drop table A;