Skip to main content

I've just started with Tableau few weeks ago and got 2 questions recently.

 

1. How to show the count AND the percentage in the same table? (i.e. a row showing the count and the next row showing the percentage)

 

2. How to make 2 dimensions independent to each other?

 

I would like the resulting table looks like the one below which is constructed by Excel:Table Calculation and independent dimensions (URGENT)

 

The Column QA and IVRS each have following values: "Good", "Medium" or "Lower"

Yellow row shows the count of the 3 values for the team, on QA and IVRS respectively.

 

Urgent! Please help!

15 answers
  1. Aug 13, 2014, 4:19 AM

    Your data structure is not great for getting the visual that you're trying to achieve.  If you're able to change it then I suggest doing that as opposed to the solution I'm providing.

    Your data structure is not great for getting the visual that you're trying to achieve. If you're able to change it then I suggest doing that as opposed to the solution I'm providing.

    I copied the example data you provided and pasted in to Tableau as a new data connection.

     

    I then modified the SQL to adjust the data structure to something more convenient for the visual you're going for:

     

    Here's the SQL I used for my connection:

    SELECT

      "QA" AS [DIMENSION],

      "Good" as [STATUS],

      (select count(*) from [table] [B] where [QA] = 'Good' and [A].[Team Leader] = [B].[Team Leader] and  [A].[Staff Member] = [B].[Staff Member]) AS [VALUE],

      [A].[Team Leader] AS [Team Leader]

    FROM [table] [A]

    UNION ALL

    SELECT

      "QA" AS [DIMENSION],

      "Medium" as [STATUS],

      (select count(*) from [table] [B] where [QA] = 'Medium' and [A].[Team Leader] = [B].[Team Leader] and  [A].[Staff Member] = [B].[Staff Member]) AS [VALUE],

      [A].[Team Leader] AS [Team Leader]

    FROM [table] [A]

    UNION ALL

    SELECT

      "QA" AS [DIMENSION],

      "Lower" as [STATUS],

      (select count(*) from [table] [B] where [QA] = 'Lower' and [A].[Team Leader] = [B].[Team Leader] and  [A].[Staff Member] = [B].[Staff Member]) AS [VALUE],

      [A].[Team Leader] AS [Team Leader]

    FROM [table] [A]

    UNION ALL

    SELECT

      "IVRS" AS [DIMENSION],

      "Good" as [STATUS],

      (select count(*) from [table] [B] where [IVRS] = 'Good' and [A].[Team Leader] = [B].[Team Leader] and  [A].[Staff Member] = [B].[Staff Member]) AS [VALUE],

      [A].[Team Leader] AS [Team Leader]

    FROM [table] [A]

    UNION ALL

    SELECT

      "IVRS" AS [DIMENSION],

      "Medium" as [STATUS],

      (select count(*) from [table] [B] where [IVRS] = 'Medium' and [A].[Team Leader] = [B].[Team Leader] and  [A].[Staff Member] = [B].[Staff Member]) AS [VALUE],

      [A].[Team Leader] AS [Team Leader]

    FROM [table] [A]

    UNION ALL

    SELECT

      "IVRS" AS [DIMENSION],

      "Lower" as [STATUS],

      (select count(*) from [table] [B] where [IVRS] = 'Lower' and [A].[Team Leader] = [B].[Team Leader] and  [A].[Staff Member] = [B].[Staff Member]) AS [VALUE],

      [A].[Team Leader] AS [Team Leader]

    FROM [table] [A]

     

    (Replace "Table" with whatever your table name is for your data connection)

    This query does two things.  It normalizes your data and gives you zeros for situations where no data exists.

     

    Like I said.  It would be way more convenient for you to have better structured data but this solution should work for you and is scalable.

     

    The calculation for the percentage is just a quick table calc of % of total on [Value] Compute using Pane Across.

0/9000