2 Replies Latest reply on Aug 11, 2016 2:04 PM by Owen Boyd

    Using trendlines with dates

    Owen Boyd

      I've been trying to get a trendline to show on a scatter plot that I've been working on, but in the analytics tab, the trendline button is grayed out. On my y-axis I'm using a number, but for the x-axis I'm using a date formatted as such: July 22, 2016. From what I've read, trendlines can't be made using strings (except dates) on one of the axes, but since the date I'm using is extracted by expanding the Timestamp tree, this shouldn't be a problem, right? I've tried simply using datediff() in a calculated field, but whenever I use that by itself on the x-axis, all of my data disappears. Any ideas?

        • 1. Re: Using trendlines with dates
          Kent Sloan

          Hi Owen,


          With out being able to look at a copy of the workbook or a screen shot my guess is that the issue is with Discrete vs Continuous format of your date. This is indicated in Tableau by blue for discrete and green for continuous. You can only do a scatter plot when a continuous field is on both the rows and columns shelves.So for example in the image below I brought in the order date as continuous by right clicking and dragging the field to the shelf ans selecting month continuous, SUM(Sales) to rows, sub-category to detail and Category to color. I then right click on the sheet and select add trend line.   





          • 2. Re: Using trendlines with dates
            Owen Boyd

            Gotcha. I can't send a screenshot of my data but switching to continuous has worked. Thanks!