Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

How to apply multiple distinct counts

I have a table that i need to count distinct values from. See simplified table example below (latest hour for day is a calculated column)

UserIDDateHourLatest Hour for day
John Smith10/01/20201010
John Smith10/01/20201010
John Smith11/01/202099
Sam Benson10/01/20201010
Sam Benson11/01/20201012
Sam Benson11/01/20201212

 

I need to have multiple measures (for each hour of the working day - roughly 12 hours). For example i need the measure for hour 10 to tell me how many times a users latest hour for the day = 10. But this can only count the the same user once per day and it needs to count every single day in the range. In the table example above for hour 10 it should return 2 because on 10/01/2020 both John Smith and Sam Bensons latest hour was 10. Sometimes one user will may multiple rows for the same date and hour which complicates things.

 

Hope this makes sense,

Thanks

4 Replies