3 Replies Latest reply on Nov 14, 2018 6:47 AM by Paul Wachtler

    Comparing values across date columns

    Jeremy Seow

      question.PNG

      Hi everyone,

       

      I am creating a dashboard as shown in the screen shot above

       

      the values are set in the label mark and is grouped according to the month/year column. I would like to compare the values across the months and change the symbol based on whether is it an increase or decrease. For example, on the 5th row, the value for August is 9.0 and for July is 40 so the symbol for August should be a down arrow. Currently I am using the Lookup function but it is comparing to the row above.

       

      Any help and advice will be appreciated, thank you!

       

      Regards,

      Jeremy

        • 1. Re: Comparing values across date columns
          Paul Wachtler

          Hi Jeremy,

           

          I'm not sure what your current lookup formula looks like but I'm thinking this below would work.  Make sure to change the field names to what you're using currently.  Also, after creating the calculation, make sure it's set to calculate using Table Across

           

          if lookup(countd(dummy),1) > countd(dummy) then "Decrease"

          elseif lookup(countd(dummy),1) = countd(dummy) then "Same"

          else "Increase"

          end

           

          Let me know how that works for you.

           

          Best,

          Paul

          • 2. Re: Comparing values across date columns
            Jeremy Seow

            Hi Paul,

             

            this is the formula that I am using and I set it to calculate Table Across as well but it doesn't work. I will just hit the else statement. I tried your method as well but seems to have the same problem

             

            Thank you,

            Jeremy

             

            ++++++++++++++++++++++++++++++

             

            IF IFNULL(FLOAT(REPLACE(
                 ATTR(SPLIT(SPLIT([Metric Value], "(", 1), "%", 1)) ,",","")
                 ), 0)

            >

            IFNULL(FLOAT(REPLACE(LOOKUP(ATTR(SPLIT(SPLIT([Metric Value], "(", 1), "%", 1)) , 1) ,",","")), 0)
                 THEN "Increased"

             

            ELSEIF IFNULL(FLOAT(REPLACE(ATTR(SPLIT(SPLIT([Metric Value], "(", 1), "%", 1)) ,",","")), 0)

            <

            IFNULL(FLOAT(REPLACE(LOOKUP(ATTR(SPLIT(SPLIT([Metric Value], "(", 1), "%", 1)) , 1)
            ,",","")), 0)
            THEN "Decreased"

             

            ELSE "Stable"
            END

            • 3. Re: Comparing values across date columns
              Paul Wachtler

              Hi Jeremy,

               

              Can you share a copy of your workbook?  It'd be much easier for me to troubleshoot this directly in Tableau.

               

              Best,

              Paul