6 Replies Latest reply on Oct 19, 2017 6:57 AM by Kostis Gkikas

# Subcounting members of Sets

Hello guys,

I have a variable called Names and a variable called Departments.

What I want is to divide the variable Names into 3 different groups and get the total subcount of the departments for each of these groups.

This means that I wat to divide Names into group A: {John, Paul, Antony} and get the total nuber of Departments that all John, Paul and Antony have.

The easy way to do that, would be something like: COUNT([Departments]) IF [Names] in A.

However, I can not find a way to do this in Tableau.

Any help would be greatly appreciated.

Thank you.

• ###### 1. Re: Subcounting members of Sets

Hi Kostis,

Find my approach based on Group-function in Tableau as reference and stored in attached workbook version 10.3 located in the original thread.

Define group based on Name

2. Just for validation..

Regards,

Norbert

• ###### 2. Re: Subcounting members of Sets

Hi Kostis,

can you please try using

{FIXED Names(group) : count(Departments)}

where

Names(group) is the group you built on Names dimension

Let us know your feedback,

hope it can help!

• ###### 3. Re: Subcounting members of Sets

Hey Norbert,

Yes this works just fine, although it's not exactly what I am looking for. What I want is to store the total count of departments per group (or set) in separate values in order to produce some line graphs with dates. So in your example, the ideal solution would be to have a variable Departments_A = 11 and a variable Departments_B = 4. That way, I can throw these two variables in a separate line graph and get a viisualization of them by date.

• ###### 4. Re: Subcounting members of Sets

Yeap, this seems to work just fine, thanx!

• ###### 5. Re: Subcounting members of Sets

Hi Kostis,

Something like this....

Regards,

Norbert

1 of 1 people found this helpful
• ###### 6. Re: Subcounting members of Sets

Yeap, that's perfect, thanx a lot for the help.