4 Replies Latest reply on Mar 12, 2013 12:09 PM by Mark Holtz

    How can I get a old month using a tableau function?

    Jonathan Pollard

      I need to calculate a field getting the old month from another field, for example:

       

      Field 1 - Money =  333
      Field 2 - Month/January =  444 - Month/February = 555 - Month/March = 666

       

      However, I want to calculate like this: "Field 1 / Old Month from Field 2"

       

      How can I do it?

        • 1. Re: How can I get a old month using a tableau function?
          Mark Holtz

          Hi Jonathan,

          I'm not sure what you mean by "old month." Are referring to the previous month of the current value? Is your Month field a datetime data type?

           

          e.g.,

          MonthValue
          1/1/2013300
          2/1/2013400
          3/1/2013500

          Are you asking how to generate a calculation to give 500/400 as the Month-over-Month change in 3/1/2013?

          • 2. Re: How can I get a old month using a tableau function?
            Jonathan Pollard

            Hi Mark,

            Thanks by atention

             

            No. I wanted tell about previous value. I gotta four fields, one field must be calculate with another field.

            For example below, look this!

             

            januaryfebruarymarchaprilmayjunejulyaugustseptemberoctobernovemberdecember
            FIELD 00,0767598220,0731045930,0707847740,0662058880,0734384790,0757483290,0774899750,069215990,0614543220,0633136470,060511877
            FIELD 1-32949-32162-32270-30614-34098-35623-36833-34476-31519-33791-33273-31208
            FIELD 2429248439945455889462406464307470281475326498093512885533708549859570808
            FIELD 34292484399454558894624064643074702814753264980935128855337085498590

             

             

            I need to do a calculate between "FIELD 1" and "FIELD 2" because a need to show a result in percent format into
            the "FIELD 0". However, the calculate have make like that: "FIELD 1 / previous month from FIELD 2" or "Value FIELD 1 month december / Value FIELD 2 month november"

             

            I try to do it but I can't help it.

            Whether you still not understood, please tell me!

             

            Many thanks!

            • 3. Re: How can I get a old month using a tableau function?
              Mark Holtz

              Jonathan,

              I think you're looking for the LOOKUP() function.

               

              I transposed your data into a source.  I still don't understand what Field 0 is because it is not Field 1 / previous Field 2... in other words, the last column does not match the first column.  The workbook I attached accomplishes this in Tableau, but I may still not have what you're after entirely right.

               

              Because LOOKUP is a table calculation, you must be sure to use the right partitioning and addressing, in this case, the month field.

               

              MonthField 0Field 1Field 2Field 3Result
              january0,076759822-32949429248429248
              february0,073104593-32162439945439945-0.07493
              march0,070784774-32270455889455889-0.07335
              april0,066205888-30614462406462406-0.06715
              may0,073438479-34098464307464307-0.07374
              june0,075748329-35623470281470281-0.07672
              july0,077489975-36833475326475326-0.07832
              august0,06921599-34476498093498093-0.07253
              september0,061454322-31519512885512885-0.06328
              october0,063313647-33791533708533708-0.06588
              november0,060511877-33273549859549859-0.06234
              december -312085708080-0.05676

               

              Hope this helps.

              • 4. Re: How can I get a old month using a tableau function?
                Jonathan Pollard

                Great!!!

                 

                It worked out all right!!!
                Thank you so much. I saw your example using LOOKUP, it's exactly that I needed.

                 

                Thanks again. Bye