1 Reply Latest reply on Aug 25, 2014 10:25 PM by Dimitri.B

    Calculated between two items of the same field.

    David Pires

      Hi

       

      I'm rather new using Tableau and this may be a very simple question. I tried looking through the forum and Knowledge Base with no success.

       

      I'm trying to calculate between two values of the same field. I have a set of categories on the left hand side and two columns with distribution from the top. In excel I would normally do x = c1/d1*100 to get the results I want but with Tableau I seem to only being able to select the field and not a dimension within the field.

       

      For example, if I have Customer as a Field and within that I have, John, Paul, Sophia, I'd like to use a similar calculation to the above between John and Paul, or Paul and Sophia. 

       

      Hope this is clear, I've attached a workbook as well.

       

      Many thanks

       

      David

        • 1. Re: Calculated between two items of the same field.
          Dimitri.B

          In Excel, each value has an address on the sheet, in your example it is C1 or D1 and so on. You know what C1 contains and can use its address in a formula.

          In Tableau, there is no such thing. Single values do not have personal address like that, and you don't know where Tableau keeps it or have any way of referencing it, so you can't use the same approach as in Excel.

           

          However, if the data is such that can be arranged in some order, then in Tableau you can use LOOKUP() table calculation to refer to different values within the same field. The trick is to arrange the data in such a way as to allow you to know that the value you need is 3 rows behind the current row or 1 row ahead, etc.

           

          I guess John, Paul, etc. don't have an inherent order and you are stuck, but if your dimension can be sorted in a logical way (e.g. department number) then you can probably do what you want here.