Concatenate Rows in Tableau

Version 1

    1.1 Introduction:

     

    Tableau is a Data visualization tool to display data in various forms as per user requests.

    This document displays a case where the Measure Value ‘No Of Tickets’ and ‘Reason ‘ gets repeated for each new row of Dimension ‘Sub Issue’  whereas in Ideal case these should be shown just once as the ‘No Of Tickets’ and ‘Reason’ are same for Issue No ‘ P101’

     

     

    User requirement is to display Reason and No Of Tickets data only once as shown in the below screenshot when there are more than one ‘Sub Issue’ values linked to an ‘Issue No’.

     

    1.1 Solution to avoid Duplicate Rows:

     

    1.1.1

    Step 1:  Create a Calculation for field Sub Issue and include the below code in the calculation.

     

     

    Include Calculated field Sub Issue into Rows Section of Tableau report.

    Important: This is a table calculation which based on field Sub Issue hence Original field Sub Issue is required in report. In order to use Sub Issue field in table calculation, drag the original Sub Issue field coming from the database into the Marks Section as shown below . Also compute the table calculation using Sub Issue field as shown below.

     

     

    The calculated Sub Issue field (dragged in rows section) will concatenate Sub Issue values of the first row in the second row.  Values of the first row will be displayed as

    shown above.

     

    1.1.1 Step 2:

    In Order to eliminate the first row, create a calculation which identifies the last row of a problem ID.

    Create Calculation “Last Sub Issue for a Row”

     

     

    This calculation will return “True “Or “False” depending on the position of Sub Issue field. To check whether this calculation is giving correct results, include this calculation in Rows section.

    IMPORTANT:  This is a table calculation and should be computed using field ‘Sub Issue ‘to achieve correct results.

     

     

    As seen above, field ‘Last Sub Issue for a Row’ returns ‘False’ for the first row of Issue No: P101 as it’s not the last row for the Issue No. Similarly this calculation will return ‘False’ for all rows until it finds Last Row for an Issue No.

    Step 3 : After Testing calculation ‘Last Sub Issue For a Row’ remove it from ‘Rows’ section of the report and include it in filters section and filter only ‘True’ Values so that duplicate rows are eliminated from the report . 

    Important: This filter is based on a table calculation and should be computed based on Sub Issue in order to display correct results.

     

     

    Conclusion: After adding the Sub Issue calculation as well as Filter ’Last Sub Issue for a Row’ = True, the desired result is achieved.

     

    Note : Refer attached document for Datasource of this Tableau Report .