4 Replies Latest reply on Apr 23, 2018 4:35 PM by Shinichiro Murakami

    Creating Dynamic Axis to Reflect Time Period Parameter (Daily, WTD, MTD, QTD, YTD)

    Annalisa Szymanski

      Hi there!  This is my first time posting so please let me know if more clarification is needed.


      Attached is the Tableau workbook that I need assistance with.  I have a bar chart of sales data with a time period parameter that allows the user to view Daily, WTD, MTD, QTD, and YTD trend metrics.

      I am having some trouble with formatting the axis of the bar chart as I am changing the time period parameter. 


      Ideally, I would like the axis to change to the below format as I select the time period parameter.


      When 'Daily' is selected show dates as:  1/6, 1/7, 1/8, 1/9, 1/10, 1/11

      When 'WTD' is selected show dates as:  1/3, 1/10, 1/17, 1/24, 1/31    (Sunday as the beginning of the week)

      When 'MTD' is selected show dates as:  'Jan', 'Feb', 'Mar', 'Apr', 'May' (abbreviate Month instead of showing 1/1, 2/1, 3/1, 4/1, 5/1)

      When 'QTD' is selected show dates as: 'Q1', 'Q2', 'Q3', 'Q4'  (instead of 1/1, 4/1, 7/1, 10/1)

      When 'YTD' is selected show dates as : '2016', '2017', '2018' (instead of 1/1/2016, 1/1/2017, 1/1/2018)


      I tried this above by creating string calculation with the dates, but since it is a string, it is messing up the ordering of the week start date. 


      Any tips, advice, or solutions would be very much appreciated.  Thank you!