Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I Have the following Fields
USER_ID,MMYY, AMOUNT , TRAVEL, LODGING, FOOD_PUB, FOOD_RESTAURANT, FOOD_FAST, MOVIES, HEALTHCARE
I want to find COUNT users who TRAVEL , Stayed in LODGING and Spent on FOOD . Also SUM the AMOUNT SPENT all these expenses.
What is the best way to count as well as SUM of All those Fields.
I have started as follows for count
=COUNT (DISTINCT (if TRAVEL > 0, if LODGING > 0, COUNT (DISTINCT { < FOOD_PUB = '>0' > + < FOOD_RESTAURANT= '>0' > + < FOOD_FAST= '>0' > } USER_ID)))
But I am confused because can't use COUNT statement twice..
Thank you in advance for your help
Is this expression for count.
= COUNT (DISTINCT { <TRAVEL = {'>0'}> * <LODGING = {'>0'}> * ( <FOOD_PUB= {'>0'}> + <FOOD_RESTAURANT= {'>0'}> + <FOOD_FAST= {'>0'}> ) } USER_ID )
Is this correct? Please note I have added explicit ()
Mohit,
Thanks for the help. But it is not working.
Here are my data for testing..(See attached excel file)
If I use the following Expression, I get 21
=COUNT(DISTINCT {<TRAVEL = {'>0'}> * <LODGING = {'>0'}> * (<FOOD_PUB = {'>0'}> + <FOOD_REST = {'>0'}> + <FOOD_FAST = {'>0'}> )} USER_ID)
If I use the expression as per your suggestion I get 24
=COUNT(DISTINCT {<TRAVEL = {'>0'}> * <LODGING = {'>0'}> * <FOOD_PUB = {'>0'}> + <FOOD_REST = {'>0'}> + <FOOD_FAST = {'>0'}> } USER_ID)
I am not sure we can use parentheses with in Set Expression.
I have also attached qlikview files..
How to add SUM?
Thanks
Mohit
It does not work..