3 Replies Latest reply on Apr 12, 2018 8:18 AM by Jim Dehner

    % Difference annotation (bar graph)

    Sam Van Portfliet

      Hello all,

       

      I am looking to have something like the following.

      I cant seem to find anything about how to get the line and percentage in red. I saw a graph from another company like this and my boss asked me to recreate it. I know you can do a percent difference table calculation, but we would want to be able to view the full values as well. any ideas?

       

      Thanks in advance,

       

      Sam

        • 1. Re: % Difference annotation (bar graph)
          Jim Dehner

          Good morning

          see the attached it shows 2 possible hacks to give you and a result

           

          the first involves a calculated field and dual axis display then edit the axis

          the calculation is nothing more that the % diff table calc wrapped in an if statement

          if year(min([Order Date]))=2017 then

          (ZN(SUM([Sales])) - LOOKUP(ZN(SUM([Sales])), -1)) / ABS(LOOKUP(ZN(SUM([Sales])), -1))else NULL end

           

           

          the second places the bar chart on a Dashboard and floats a text container on the chart where you can enter static text

           

           

          Jim

           

          If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution.  Thank you.

          1 of 1 people found this helpful
          • 2. Re: % Difference annotation (bar graph)
            Sam Van Portfliet

            Jim,

             

            Thanks for the help but I tried to use the formula you posted above the first picture and Im getting a aggregate error "cannot use aggregate and non aggregate...blah blahh" am I doing something wrong?

             

             

            Thanks,

            • 3. Re: % Difference annotation (bar graph)
              Jim Dehner

              Ok

              Tableau needs to have all the values in a formula at the same level of aggregation - Sum() in the formula is an aggregation but [Year] is not aggregated

               

              you can use min().max(),or Attr() to aggregate the year whatever is appropriate in the book

               

              Jim

               

              If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution.  Thank you.