Question

Help with a query

  • 4 August 2021
  • 2 replies
  • 18 views

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.”


2 replies

Userlevel 1

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.

Thanks @Chris_Tinnon 

Reply