1 Reply Latest reply on May 26, 2016 1:58 PM by Adam.Cogswell

    How to Count on the dynamic group

    Penpitcha Siriwan

      I got the requirement about to present the no. of record of the dynamic group in Tableau 9.3. It's simple in SQL query but I cannot figure out how to implement in Tableau.

       

      Below is the sql query that return me the expected result:

       

      select count(*) as number_of_records

      from

           (select *

           from tableA

           group by colunm1,colunm2,colunm3,colunm4,colunm5

           ) criteria_group

       

      And I need the dynamic "group by". For example,sometime I may  need to remove the colunm1 out of the group by, so there will be only colunm2-colunm5 in the group by, or I may need to have where clause in the sub-query like this:

       

      select count(*) as number_of_records

      from

           (select *

           from tableA

           Where column5 in ( 'xxx','yyy')

           group by colunm2,colunm3,colunm4,colunm5

           ) criteria_group

       

      Do you have any idea for me to create this case in Tableau?

      Please help!

       

      Thank you,

      Ing