Skip to main content

hi folks,  i have one issue with tableau. I have view like customer-> category-> product name-> sales.   I want to concate 2 columns - Category and product name into single row for each customer. and still user can filter for category, product name and customer and corresponding sales should change as per filter. I am able to concate category and its working fine. But I am not able to get single row for product. It is showing product name as per category.  Could someone check this and let me know how to fix at tableau level.  Thanks,  BS   

2 answers
  1. Apr 2, 7:48 PM

    Hi @basic seeker

     

     

    Here is a solution: 

    1. Calculation for Product concatenation (that's the easy one) - "Product Concat":

    PREVIOUS_VALUE(ATTR([Product Name])) + ", " + ATTR([Product Name])

    2. Helper calculation for Category - "Prev Category":

    LOOKUP(ATTR([Category]), -1)

    3. Calculation for Category concatenation - "Category Concat":

    PREVIOUS_VALUE("") +

    IF [Prev Category] = ATTR([Category]) THEN ""

    ELSE ", " + ATTR([Category])

    END

    Now when I use the calculations I onen "Edit Table Calculation" on each and define the settings: 

    Hi Here is a solution: 1. Calculation for Product concatenation (that's the easy one) -

    But note that the Concat Category field is a nested table calculation and you have two settings - both the same as above, but for both Prev Category and Concat Category: 

    image.png

    The last step (I think you already know this) is to add a LAST() = 0 filter, in order to display just the last row for each customer. 

    The workbook is attached. 

     

    Dan Chissick

    Senior BI Consultant | Tableau Ambassador

0/9000