4 Replies Latest reply on Oct 2, 2013 2:05 PM by Pedro Machado

    Week Over Week Line Chart Challenge

    Dwight Taylor

      Okay Tableau Jedi's really need your wisdom.  I've pulled out my hair attempting to figure out a way to display a week over week line graph with MONTH/DAY (days) on the horizontal axis as opposed to Weekdays.  Unfortunately, as you can see in the attached workbook, I'm only able to create a dual axis using Weekdays on the axis.  I take the general Count measure and drive This Week and Last Week counts using Date Calculations and an anchor date (parameter using the Range of dates in the data).


      Ultimately, I want to produce a week over week line graph for a rolling two weeks.  For example, today my week over week line chart would show 9/26 thru 10/2 on the axis.  The current weeks line would only display data points for Sunday (9/29), Monday (9/30), Tuesday (10/1) and Wednesday (10/2).  The previous weeks line would display comparative data points for all 7 days, assuming there was data for each day last week.


      The problems:  using a parameter only takes you as far as the last state of the parameter.  Which means if I update the data in the workbook, which I plan to do frequently, the parameter no longer delivers unless it constantly updated to the last day of the two weeks.  By the way, this is a flaw in Tableau, but my approach in resolving this challenge.


      Any help would be greatly appreciated.

        • 1. Re: Week Over Week Line Chart Challenge
          Pedro Machado

          Hi Dwight,


          Is this what your are looking for?


          Here is what I did:


          - Duplicated the data source

          - Renamed the Date field in the secondary (copy) data source

          - Created new Date field in the secondary data source equal to Original Date + 7

          - Created blended view showing count from the primary data source (this week's count) and that from the secondary data source (last week's count)

          - For the filter, I used a calculated field that looks for the maximum date in the view and shows the last 7 dates (based on the primary view). Alternatively, if you will have real time data, you can just use a regular filter on Date where Date >= toda() - 7. If you use my approach, you have to keep in mind that Tableau is retreiving all the dates and doing a filter after running the table calc. This can be slow depending on the amount of data. I would recommend you add a filter to limit the amount of data pulled from your back end data source as well.





          • 2. Re: Week Over Week Line Chart Challenge
            Dwight Taylor

            Hi Pedro, great approach.  As you mentioned, my first concern is the performance hit with a double data source connection and then a Tableau Blend on top of that.  Although the Workbook will only have a small amount of data in it at any given time (less than 20K rows), my Dashboard has 9 different worksheets (requirements driven, not best practice driven).  With that many worksheets, I'm concerned about the performance hit for the Dashboard.  However, I'm implementing and I'll let you know how it goes, thanks.

            • 3. Re: Week Over Week Line Chart Challenge
              Dwight Taylor

              Turns out Pedro NAILED IT!  Thank you kind sir!

              • 4. Re: Week Over Week Line Chart Challenge
                Pedro Machado

                You're welcome. I'm glad it worked.