I'm trying to determine how many unique values from one column can be grouped by values in another column.
There are many columns in my sheet, but the ones I'm interested in are: 'department' and 'user'
How the data is that for these two columns, there are repeat users with the same department.
Eg.
Department User
Insights Mike
Insights Mike
Insights Chris
Market Julie
Research Will
Research Sabrina
Research Bryan
Department DistinctUsers
Insights 2
Market 1
Research 3
SELECT department, COUNT(DISTINCT user)
FROM Sheet1
GROUP BY department, user
(SELECT DISTINCT User from Sheet1)
FROM
As mentioned in the comments, you just need to remove users from the group by.
SELECT
department,
COUNT(DISTINCT [user]) as CT
FROM Sheet1
GROUP BY department
ACCESS
SELECT
department,
count([user])
FROM
(SELECT DISTINCT department, [user] from Sheet1) as x
GROUP BY
department