6 Replies Latest reply: Oct 30, 2011 12:16 PM by Stefan Wühl

# Expression  Definition

I have a table which contains data as follows

Country,  User ID,  CardUsageCount , keyUsageCount, MMYYYY

USA,      U12,         122,                    221                  , 042011

USA,      U16,          0,                      500                  , 042011

USA        U12,         60,                    122,                 ,052011

USA       U60,           200,                 120,                 , 052011

I want to create a barchart  of CardUsers per country.

So the filnal data will look like as follows

Country, CardUageCount

USA,       2

(One user U16 will be dropped as CardUsageCount=0. Since it is Distinct, U12 will be counted only once)

I kept Dimension = Country

Expression = if(  (Count ( CardUsageCount)) >= 1, Count (DISTINCT CardUsageCount))

I am not getting the results I needed. Anything wrong with my expression?

Thanks

• ###### Expression  Definition

I think it should look like

=Count (DISTINCT if(CardUsageCount>0, [User ID]))

• ###### Expression  Definition

Thanks swuehi, your inputs helped to solve.

• ###### Expression  Definition

In case if I need to add %of CardUsers percountry, how do I do it?

• ###### Expression  Definition

Could you give an example by using your above sample data how do you define % of CardUsers per Country?

• ###### Expression  Definition

I have large data about 5000 lines. To simplify I have provided few lines of data in the above example.

• ###### Expression  Definition

Yes, I intended to know what your definition of this percentage is.

I could think of e.g.

=Count (DISTINCT if(CardUsageCount>0, [User ID])) / count( if(CardUsageCount>0, [User ID]))

so it will give e.g. for USA a 66% percentage, or maybe

=Count (DISTINCT if(CardUsageCount>0, [User ID])) / count([User ID])

giving a 50% percentage or

=Count (DISTINCT if(CardUsageCount>0, [User ID])) / count (distinct [User ID])

giving again 66% in this sample.

Since I don't know what you define as % of CardUsers per Country, I am just guessing.