Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Distinct Count of two columns

Hi,

I have two columns that have the Employee IDs.

I want to get these three values:

1. Distinct Employees in Column 1

2. Distinct Employees in Column 2

3. Distinct Employees that appear in both columns

The first two are straightforward but I'm struggling with the last scenario.

Please help

5 Replies
sunny_talwar

May be like this

1) Count(DISTINCT [Column 1])

2) Count(DISTINCT [Column 2])

3) Sum(If([Column 1] = [Column 2], 1, 0))

Not applicable
Author

The third doesn't give me a distinct count. It gives me total rows not distinct Employee IDs

sunny_talwar

See the approach that Stefan has mentioned in robert_mika‌'s link

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

SampleData:

LOAD

*

INLINE [

ID1, ID2

1,2

2,5

3,6];

=Count(DISTINCT ID1)  + Count({<ID2-=P(ID1)>} DISTINCT ID2)

Hope this helps you

Regards,

Jagan.