9 Replies Latest reply: May 12, 2015 9:01 AM by Stuart Frew

# Percentage of Gender

Hi,

Having some issues with a dimensionless straight table; sure its something easy.

My Data has the following columns

CustomerID, Gender

1111, Male

2222, Male

3333, Female

How do I properly calculate the percentage of Male customer ID's? I seem to be able to calculate it fine but when selections are made the percentage does not make sense.

=(count(distinct{\$<Gender={'Male'}>}  CustomerID))

/

count( DISTINCT CustomerID)

This gives 52% with no selections. When I choose Male in a Filter box it shows 100%

BUT when I choose Female in a list box it shows 132%

What am I doing incorrect?

• ###### Re: Percentage of Gender

When you choose Male the Female will be filtered out so for each ID 1111,2222 there is only one Male so is 100%

What do you expect when choosing Female with your current expression(Male).

You can use {1}

=count({1<Gender={'Male'}>}  CustomerID)/count({1} Gender)

To disregard all selections.

• ###### Re: Percentage of Gender

if I choose female then the

Female percent should be 100%

=(count(distinct{\$<Gender={'Female'}>}  CustomerID))

/

count( DISTINCT CustomerID)

male percent should be 0%

=(count(distinct{\$<Gender={'Male'}>}  CustomerID))

/

count( DISTINCT CustomerID)

OR

even if the percentages were a percentage of the total count.

No selections = M 50% F 50%

Select F = M 0% F50%

Select New York - M 0% F 35%

• ###### Re: Percentage of Gender

When you filter Female your expression perfom the calculation Male / Female.

If you want a single expression to calculate percentage dinamically based on Gender selection try this:

Count({<Gender={"\$(=GetFieldSelections(Gender))"}>}DISTINCT Customer) / Count({1}DISTINCT Customer)

• ###### Re: Percentage of Gender

When you perform a selection the sub set formed in numerator is always releated to the total Customer count.

Example: selections: Gender = Male, City = New York

Calculation: Male in New York / Total Customers

• ###### Re: Percentage of Gender

Hi - i tried your expression but it returns '-'

• ###### Re: Percentage of Gender

Hi Stuart,

can you please share your app? let me check if its a data issue?

• ###### Re: Percentage of Gender

Hi Stuart...

Regards,

• ###### Re: Percentage of Gender

Hi,

the set expression {\$<Gender={'Male'}>} lets your count of male customers disregard the gender selection, while count( DISTINCT CustomerID) only counts the selected female customers.

so possible solution could be:

`count(distinct{\$*1<Gender={'Male'}>}  CustomerID)/count( DISTINCT CustomerID)`

or

`count(distinct{\$<CustomerID=p({\$<Gender={'Male'}>} CustomerID)>}  CustomerID)/count( DISTINCT CustomerID)`

hope this helps

regards

Marco

• ###### Re: Percentage of Gender

Thanks Marco,

And is it possible to have another calculation where essentially the percentage decreases the more selections ones makes

Choose Male = 50%

Choose Age 25-35 = 20%

Choose Country America = 3%