4 Replies Latest reply on Aug 31, 2016 7:01 AM by Adarsh Suresh

    Displaying Rolling average and most recent week side by side

    Adarsh Suresh

      I am trying to create a Tableau sheet that displays the most recent week's data side by side with the rolling 13 week average in order to show the difference.

      I have been able to get a temporary view that displays all 13 weeks and then calculates the average of the displayed columns and makes an average bar next to it.

      It would be great if the 12 other weeks could somehow automatically be hidden rather than manually hiding them each time.

       

      Here is an example of what I am trying to build.

        • 1. Re: Displaying Rolling average and most recent week side by side
          David Li

          Hi Adarsh, you should try to hide them with table calculation filters. Create a calculated field like this:

          LAST() = 0

          Then, put this into the filters. Make sure it's computing along the weeks (probably Table Across is okay), and then filter so only TRUE values are showing. That should hide the other weeks without removing them from the calculations.

          • 2. Re: Displaying Rolling average and most recent week side by side
            Adarsh Suresh

            Hi David,

             

            The Date measure I use is not in the form of an actual date. It is basically the count of the week; for example the 43rd week since I started collecting the data is 43.

            Will that affect the LAST() function?

            Also, I couldn't really find any information about the last function. Could you give me more details on what it is doing?

             

            Thanks!

            • 3. Re: Displaying Rolling average and most recent week side by side
              David Li

              That won't make a difference as long as the table calculation is computing along the correct dimension. The dimension's data type doesn't matter.

               

              The LAST() function is a table calculation function that returns the number of cells between the current cell of the calculation and the last cell in the partition. For instance, let's say that you have data from one year broken out into 12 months (along columns), and your table calculation is computing along Table (Across). You have 12 cells in this partition. If you look at November, LAST() for that cell will be 1, because it's 1 cell away from the last cell of the partition (which is December).

               

              Two other indexing table calculations INDEX(), which gives you the absolute position of the cell (a.k.a. the index) in the partition, and FIRST(), which is just like LAST() except that it references the first cell in the partition.

              1 of 1 people found this helpful
              • 4. Re: Displaying Rolling average and most recent week side by side
                Adarsh Suresh

                Hi David,

                 

                Thanks! Your solution is working to a degree. I am still having an issue with displaying all the data. I have the data organinzed into 5 different groups. So the view should ideally look like 5 adjacent versions of the two bars I had in the OP. Using you method I get just what I am looking for for one of the groups, but the other four groups disappear. Have you seen that issue before?

                 

                Thanks,

                Adarsh Suresh