6 Replies Latest reply on Aug 3, 2014 3:45 AM by Jack Freeman

    Add trend lines for yearly data

    George T

      tableau_capture.PNG.png

      I have a data of points scored for 40 soccer teams in the years 2000-2013.  I have that data plotted for each team so I have

      1 big graph but divided into 40 subgraphs (for each team).  The points scored and the years are numeric measures.  I  am trying to add a trend line for each of the 40 subgraph but I got the "Trend line cannot be computed error. Each axis should be number or date."  message.

      How can I add the trend lines in my case?

       

      I have attached an image for two teams.  Again, I am trying to add trend lines for each of the 40 teams. 

        • 1. Re: Add trend lines for yearly data
          Matt Lutton

          Is the YEAR originated from a DATE field?  If its a String, that might explain the error.

           

          Post a packaged workbook example, and I'm happy to take a look--its difficult to guess at what's happening without seeing a workbook, or at least a screenshot showing your full screen, including all pills on all shelves.

           

          Cheers!

          • 2. Re: Add trend lines for yearly data
            George T

            No the years are numeric measures.

            • 3. Re: Add trend lines for yearly data
              Matt Lutton

              Again, post a packaged workbook and we can help you--otherwise, its nearly impossible to know whats going on.  What field represents your Years?  The screenshot helps, but not much, because we cannot view the data.

              • 4. Re: Add trend lines for yearly data
                allan.walker.0

                DATE(STR([YEAR]))

                • 5. Re: Add trend lines for yearly data
                  Matt Lutton

                  Allan is suggesting that you convert your integer year field into a true DATE field, using his formula, and use that in your view.

                   

                  However, I'm not sure you've got the view set up properly for what you want to do, so posting a workbook would be ideal for all helpers.

                  • 6. Re: Add trend lines for yearly data
                    Jack Freeman

                    Matthew, I'm trying to do the same thing as George T., and I also get the message, "Trend line cannot be computed error. Each axis should be number or date." I don't understand the message because the X-Axis is time in Months and the Y-Axis is sales revenue in Dollars. I could plot it on a graph myself and could calculate points along a linear trend line using Y=mX+b. Excel does a "graphical approximation" and displays the equation for the trend line and an "r-squared" value. I'm not understanding why Tableau can't

                     

                    A colleague was trying to explain to me why - something about Tableau not interpreting the "Months" axis as a continuum but simply as column names. Do I need to format the cells as dates in Excel before I data into Tableau?

                     

                    Here is what I have so far, but it won't compute a trend line. Note the "0 or more Dimensions" indicator. Again, why isn't Time a dimension?Attempting Trend Lines 1.jpg

                    Thanks for any input that will help me do this. I'm sure someone has figured out a way to do it. Jack