1 Reply Latest reply on May 15, 2018 4:41 PM by Youwei Chen

    Need help with custom aggregation on tableau

    Youwei Chen

      We come across a report that require a many calculated aggregations, include multi level aggregation.

       

      This is a final view I want to create from line item and a mapping file: notice multiple level of aggregation.

      pastedImage_2.png

      Underlying data is leaf data, I can define child - parent relationship using a new column.

      Ideally, I like to aggregate all child data and show parent line on top with total like example above.

       

      What is best way to achieve this result?

       

      I tried to add two line item together manually, that did not work well.   If I can define parent relation ship, can tableau show show total in a format similar to screenshot above?

       

      if ([Line Item2] = '1') then

          { FIXED [Value]:

              sum(if ([Line Item1] = '1A') then [Value] end)  +

              sum(if ([Line Item1] = '1B') then [Value] end)

          }

      ELSE

          [Value]

      END

         

      I added two tableau worksheet, first one has output I wanted, with manually aggregated data.  2nd tableau sheet trying to aggregate data using calculated field, did not work as expected.

       

      Thanks,

       

      Message was edited by: Youwei Chen