DistinctCount based on another column

FanofExcel18

Board Regular
Joined
Jun 7, 2018
Messages
65
I have 2 separate columns in the same table. I would like to have the Distinct Count of Case Owners.

The result from below should be 3: John Smith, Jane Doe, Richard Blank


FieldNew Value
Case OwnerJohn Smith
StatusActive
StatusPending
Case OwnerJane Doe
Case OwnerJohn Smith
TypeInvoice
Case OwnerRichard Blank
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
If you have Office 365, then this should be easy with the dynamic arrays

Book1
ABCD
1FieldNew Value
2Case OwnerJohn Smith3
3StatusActive
4StatusPending
5Case OwnerJane Doe
6Case OwnerJohn Smith
7TypeInvoice
8Case OwnerRichard Blank
Sheet11
Cell Formulas
RangeFormula
D2D2=COUNTA(UNIQUE(FILTER($B$2:$B$8,$A$2:$A$8="Case Owner")))
 
Upvote 0
FYI:
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    res = Table.Group(
                      Source,
                      "Field",
                      {"n",each
                                let a=List.Distinct(_[New Value])
                                in
                                    Text.From(List.Count(a))&":"&Text.Combine(a,",")
                      }
                     )
in
    res
1627025462520.png
 
Upvote 0
If you only want to get "3: John Smith, Jane Doe, Richard Blank", you could try below code:
Power Query:
= let a=List.Distinct(Table.SelectRows(Source,each [Field]="Case Owner")[New Value]) in Text.From(List.Count(a))&":"&Text.Combine(a,",")
1627025744883.png
 
Upvote 0
If you have Office 365, then this should be easy with the dynamic arrays

Book1
ABCD
1FieldNew Value
2Case OwnerJohn Smith3
3StatusActive
4StatusPending
5Case OwnerJane Doe
6Case OwnerJohn Smith
7TypeInvoice
8Case OwnerRichard Blank
Sheet11
Cell Formulas
RangeFormula
D2D2=COUNTA(UNIQUE(FILTER($B$2:$B$8,$A$2:$A$8="Case Owner")))
Didn't realise it was a PQ question :cool:
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top