# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Talk to Experts, a LIVE Q&A Webinar. Bring your Qlik Sense Business questions on Aug. 4th. Register
cancel
Showing results for
Did you mean:
Highlighted
Contributor III

## Count of Subset of data

I have a set of claims that all contain member information.  I want to get a count of Male/Female of the distinct member#'s.   I thought initially a simple count of gender field would be sufficient, but then I realized that I was counting the claims and not the distinct members.

do I need to create the distinct member subset on load or is there a way to do it through an expression? I'm hoping there's a way to do it with an expression.

1 Solution

Accepted Solutions
Highlighted
Creator III

Hi sicdud,

try the following expression

Count(Distinct {\$< Gender={"Male"}>}member)

Count( Distinct {\$< Gender={"Female"}>}member)

regards,

Nitin.

10 Replies
Highlighted
Partner

as you said

count (#member) give you the numebr of members in general and if the field #member is used in each claim line is is counted as many as they are available.

count(distinct #member) is counting each different #member one time.

better is a

1 as count_member

in your member table and a sum (count_member) as expression

Regards

Highlighted
Contributor III

@martinpohl  right, but I'm not counting the members, I need to count how many male/female out of the distinct members from the table.  so example, there's 100 claims, but only 25 different members, I need the count of 13 Male and 12 Female

Highlighted
Partner

Assuming that gender is a property of a member then you could use set analysis. Assuming your member count expression is  sum (count_member) .

Then you can do like this

sum ( {\$< Gender={"Male"}>}count_member)

sum ( {\$< Gender={"Female"}>}count_member)

Plees ekskuse my Swenglish and or Norweglish spelling misstakes
Highlighted
Contributor II

Bom dia!

tenho algo parecido que também não estou conseguindo fazer, tenho uma coluna na minha tabela, coluna Cargo, nessa coluna tem vários cargos, Comprador, Vendedor, Gerente, Analista, etc.... e queria contar quantos vendedor tem.

segue essa mesma logica?

Att.

MSchatz

Highlighted
Creator III

Hi sicdud,

try the following expression

Count(Distinct {\$< Gender={"Male"}>}member)

Count( Distinct {\$< Gender={"Female"}>}member)

regards,

Nitin.

Highlighted
Partner

Yes, use the same logic

Count( {< Position = {'Vendedor'}>} Position)

Plees ekskuse my Swenglish and or Norweglish spelling misstakes
Contributor III

@NitinK7  Thank you for this, it worked for what I needed for this

Count(Distinct {\$< [sex]={"M","F"}, statusdesc={1} >} [member#])

However, what if I had like 15 or 30 different options in the "Sex" field?   is there a way to group by that entire field without having to specify out each individual option?  I have other similar charts that I would like to create, but the fields I will be using have more than just the two options.

Highlighted
Contributor II

sou iniciante, e estou dando meus primeiros passos 🙂

Highlighted
Contributor II

Incluindo mais um filtro, quero saber quantos vendedor tem na empresa 5.

{\$ <EMPRESA = { "5"}}

?