2 Replies Latest reply on Aug 29, 2012 9:05 PM by Bryan Cheah

    Using Arithmetics in Tableau

    Bryan Cheah

      Good day all,

       

      I have a question on doing arithmetics in Tableau software.

       

      I have a dataset with a field name called Account Codes and a field name called Amount $US

       

      This is the problem,

       

      I have grouped the Account Codes i.e. 001,002,003 into a group called "Revenue"

       

      and I have other Account Codes i.e 005 and I named it "Sales Reserve".

       

      I want to find out what is the percentage of Sales Reserve against Revenue.

       

      Say in the dataset there are 50,000 lines of data. Revenue adds up 500M and Sales Reserve adds up to 30M so in excel I just do up a pivot and select "Formula", then "Calculated Item" within the field and I can do up a simple calculation of " = Sales Reserve/ Revenue"

       

      Is it possible to do the same thing in Tableau?

       

      Thank you in advance for your advice

        • 1. Re: Using Arithmetics in Tableau
          Jonathan Drummey

          Hi Bryan,

           

          Given the data, you'd set up the following three calculations:

           

          Sales Reserve Amount: IF [Group] = "Sales Reserve" THEN [Amount]

          Revenue Amount: IF [Group] = "Revenue" THEN [Amount]

           

          % Sales Reserve/Revenue = SUM([Sales Reserve])/SUM([Revenue])

           

          For this to work as described, neither the Account Code nor the Group can be in the overall level of detail of the view (Rows, Columns, Page Shelves or any shelf on the Marks Card, however the Filters Shelf is ok). If you need either of those two fields in the view, then there alternatives that can be created, the exact method would depend on your desired results.

           

          Jonathan

          • 2. Re: Using Arithmetics in Tableau
            Bryan Cheah

            Hi Jonathan,

             

            Thanks for the tip!

             

            Bryan