3 Replies Latest reply on Feb 21, 2017 3:28 AM by André Coelho

# Date Periods

Hello!

I'm Trying to work with a date dimension called [Dtdistrato]. It's data since 2007.

All I want to do is create time periods until the end of my dataset.

- Period 1: from (today) until (today - 36 months)

- Period 2: from (today - 12 months) until (today - 48 months)

- Period 3: from (today - 24months) until (today - 60 months)

- ... and keep going on ...

eg.:        (mm.dd.yyyy) to (mm.dd.yyyy)

Period 1: (02.20.2017) to (02.20.2014)

Period 2: (02.20.2016) to (02.20.2013)

Period 3: (02.20.2015) to (02.20.2012)

Period 4: (02.20.2014) to (02.20.2011)

...

Any ideas?

• ###### 1. Re: Date Periods

Hi Andre,

Can you share a sample workbook?

Please look into these KB articles: Creating Date Calculations for Specific Date Ranges | Tableau Software

Thanks,

Tharashasank

• ###### 2. Re: Date Periods

Good morning

Have you tried a calculated field in the form of

3year period >>> If [date] > dateadd('month',-36,today()) then [value] end

then do similar calculations for 48 and 60 months

Let me know if this helped

Jim

• ###### 3. Re: Date Periods

I'll try to be more clear.

My goal here is to calculate growth rate comparing period 1 with period 2, period 2 with period 3, ..., and create a line graph with this data.

eg.:        (mm.dd.yyyy) to (mm.dd.yyyy)

Period 1: (02.20.2017) to (02.20.2014)

Period 2: (02.20.2016) to (02.20.2013)

Period 3: (02.20.2015) to (02.20.2012)

Period 4: (02.20.2014) to (02.20.2011)

...

The fields I need to work to are [Dtdistrato] and [Vltotal].

Example of my major problem:

I have to assign for date (20.02.2015) periods 1 and 2. Any IF or CASE calculations only let me assign one different period for each date in my dataset.

Any ideas?