1 Reply Latest reply on Sep 29, 2016 2:46 AM by sivasangari Chinnappa

    AGG value and table calculation

    Rainer Sabangan

      I am using an calculated field (count distinct) for table calculations, percent of total.

      However, it is not giving me the right percentages.

      From the example below,

      2010 total is 1,401.

      So 2010 Express Air % should equal 223 / 1401 = 16%, but what is being displayed is 20%.

      Also, the total row % is more than 100%.

      Attached is the packaged workbook.

      Thanks a lot!

        • 1. Re: AGG value and table calculation
          sivasangari Chinnappa

          Hi Rainer,

           

          The problem occurs because of duplication of customer id.

          For Ex: Cust A may have ordered through ship mode Delivery Truck as well as Express air. When Tableau calculates Count distinct, it will be calculated as 1 in each of the above category(1+1 = 2). But when comes to total, tableau will calculate count distinct at overall level. i.e it will not consider ship mode separately. Hence it will not give result as 2, instead will give result as 1. you can check this by enabling row total which will come around 1130 for 2010 instead of 1401.

           

          So, it is better to create separate calculated field for % using window sum computed using table across.

           

          COUNTD([Customer ID])/WINDOW_SUM(([CustCount]),first(),last())

           

           

          Regards,

          Sangari