3 Replies Latest reply on Aug 16, 2018 3:50 AM by Jim Dehner

    Get % change from current week days to the same last week days

    Bhavana Khairnar

      Hello Everyone,


      i want to get the % change on last week days from Current week.
      Days       Like last sales        Current week sales      % change

      Monday       200                         400                          50%+
      Tuesday      100                         70                            30 %-


      So i have got sales numbers for last week and current week by doing below calcs

      _Max Date
      { FIXED DATEPART('year', [Order Date]),DATEPART('month', [Order Date]) : MAX([Order Date])}


      _Previous Week Day

      DATE([_Max Date]-7)


      _Prior Week Day

      DATE([_Previous Week Day]-7)


      _current Week Sales

      IF [Order Date]>=[_Max Date]-7





      _Previous Week Sales

      IF [Order Date]>= [_Prior Week Day] AND [Order Date]<= [_Previous Week Day]





      This is how my view looks Like

      After little cleaning up this is how it looks


      But when I want to get difference between current wk sales - previous week sales then I get 0, I don't know what I am doing wrong
      This is my calculation for difference


      _week Diff

      { FIXED DATEPART('year', [Order Date]),DATEPART('month', [Order Date]): SUM([_Previous Week Sales]-[_current Week Sales] )}

      [_Previous Week Sales]-[_current Week Sales]


      can anyone help me ? I have attached my workbook it's based on sample superstore.


      Tableau Version : 2018.2


      Thanks a lot in advance.