10 Replies Latest reply on Aug 29, 2018 2:14 PM by vickram.jain.0

    Tableau equivalent of distinct and group by functions

    vickram.jain.0

      I have a table as below, and would like to calculate the number of games per user.

       

      user_id
      game_idcreated
      112018-08-29
      122018-08-29
      132018-08-29
      212018-08-29
      222018-08-29
      312018-08-29

       

      In SQL, this is fairly straight forward. I can run a query as below:

       

      select count(*) _count, user_id from (

           select distinct game_id, user_id

           from public."transaction"

           where created > '2018-08-29'
      )

       

      to generate the following result:

       

      _countuser_id
      31
      22
      13

       

      How can I achieve the same in tableau? Ideally, I'd like to be able to chart the _count as it changes by a time period (days, weeks, months).

       

      Appreciate any help you may be able to offer.