5 Replies Latest reply: Oct 21, 2016 2:43 AM by jagan mohan rao appala

# 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 12. Distinct Employees in Column 23. Distinct Employees that appear in both columns

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

• ###### Re: Distinct Count of two columns

May be like this

1) Count(DISTINCT [Column 1])

2) Count(DISTINCT [Column 2])

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

• ###### Re: Distinct Count of two columns

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

• ###### Re: Distinct Count of two columns

See the approach that Stefan has mentioned in Robert's link

• ###### Re: Distinct Count of two columns

Hi,

Try like this

SampleData:

*

INLINE [

ID1, ID2

1,2

2,5

3,6];

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

Hope this helps you

Regards,

Jagan.