0 Replies Latest reply on May 8, 2017 3:06 PM by Ginger Macfarlan

    Year over Year % Change from Weekly Data

    Ginger Macfarlan

      Hello all,

       

      Nice to meet all of you today at the NWA Sharegroup--I'm looking forward to becoming more engaged and taking advantage of your expertise!

       

      I wasn't able to catch the lady asking about YoY calcs after the meeting, but I wanted to expound on how I calculated Week of Year and Fiscal Year fields to show % change vs LY by week. Working with dates in Tableau has certainly been one of my own biggest pain points, and I've ended up doing quite a bit of data wrangling upstream--but this is a handy way to calculate a % change within Tableau itself.

       

      A few points about this method:

      • It requires that you have a WM Week field in your data ( "Retailer Week" in the attached .twbx)
      • The downside: it relies on a Table Calculation for the % Change--which of course means it will only work in a tabular format.
      • The upside: it's pretty quick to throw together!

       

      Feel free to poke around in the twbx. Here is a detailed explanation in case it's helpful.

       

      1. Create a "Retailer Week of Year" field: RIGHT([Retailer Week],2)

       

      2. Create a "Retailer Fiscal Year" field: LEFT([Retailer Week],4)

       

      3. Drag "Retailer Week of Year" to Rows and "Retailer Fiscal Year" to Columns.

       

      4. Drag your desired measure (I used Sales) into the view, to Text.

       

      5. Right click Sales to create a % Diff Quick Table Calculation, then click and drag this field back to your measures pane so it saves as a separate calculation. This is a good opportunity to change your Default Number Format like Megan showed us.

       

      6. Drag the original "Sales" field to Text again.

       

      7. If desired, edit your Text--for example, if you prefer your Sales and % Change fields to be aligned, you can do that by clicking Text, then clicking the ellipsis to open the editing pane. If you have more than one measure on Text, Tableau defaults to inserting a paragraph break after the first measure--you can delete this break and add a few spaces in between the fields. I also italicized % Change in this editing box to set it off in the view.