Help with a query

bonomi
Participant I

Sorry, don’t know how to phrase this.

I have this source data:

            

date user_id thread_viewed_id
2021-01-01  1 100
2021-01-01  1 212
2021-01-01  1 412
2021-01-01  2 686
2021-01-01  2 415
2021-01-01  3 667
2021-01-01  4 101
2021-01-01  4 892

Looking at this I can see that 3 users viewed at least 2 threads, but how do I query for this?

I can query distinct users and distinct dates, but I don’t know how to do the calculation/view/dimension(?) (in LookmL?) for “unique user with more than 2 distinct threads viewed.”

0 2 76
2 REPLIES 2

Chris_Tinnon
Participant III

You should be able to use count_distinct on user_id.

measure: distinct_users {

    type: count_distinct

    sql: ${TABLE}.”USER_ID”

}

From there, you should be able to filter on the measure where count > 1.

bonomi
Participant I

Thanks @Chris_Tinnon 

Top Labels in this Space
Top Solution Authors