Skip to main content

Is it possible to force Tableau to use different date formats in the same chart?

 

Heres what I mean:

 

I have a dataset that has several thousand rows and each row has a date (1/1/15). I can organize into a bar chart and have tableau group them by year (2014, 2015, 2016, 2017). However, I would like for tableau to use a different grouping for the last bar and have it grab the last 12 months.

 

So the resulting bar chart would look something like

 

(2014 - Calendar year) (2015 - Calendar Year) (2016-Calendar Year) (2017-Last 12 months)

 

Thanks

5 answers
  1. Nov 8, 2017, 7:45 PM

    You'll need to create a calculation per year:

     

    I.e. your 2014 calculation would be;

    SUM(

    IF YEAR([Sale Date]) = 2014 THEN [Sales] END

    )

     

    2015 and 2016 calcs would be effectively the same as this, just swap out the year.

     

    Then your 2017 calculation would be more dynamic;

    SUM(

    IF [Sale Date] >= dateadd('year',-1,today()) THEN [Sales] END

    )

     

    Then use the 'Measure Values' and Measure Names to create a chart.

0/9000