7 Replies Latest reply on Oct 14, 2016 5:48 AM by John Dashiell

# Same period last year and this year

I am looking to filter based on matching current year period and last year same period. For example: today is 10/13/16, I want to filter my date to 1/1/15 - 10/13/15 and 1/1/16 - 10/13/16; so basically remove 10/14/15 - 12/31/15. I want this to be dynamic based on the current day, so if I were to use my viz tomorrow it would can the filter to 1/1/15 - 10/14/15 and 1/1/16 - 10/14/16.

My date dimension is the whole date, I do not have month, day and year broken out.

• ###### 1. Re: Same period last year and this year

Hi Nasir,

Here's one way you can solve this, create a calculated filed that shifts all your dates to be the current year [Shifted Date]:

Then place this calculation on filters as a relative date filter for "Year to date"

Now your data will filter for January 1st to Today regardless of year.

Take care,

Keshia

2 of 2 people found this helpful
• ###### 2. Re: Same period last year and this year

I will not be able to display my data separate by year with this method correct? I am looking to show the data side by side to show the comparison.

• ###### 3. Re: Same period last year and this year

Keshia,

I see how to use this. Only use it in the filter. When I use the original date field it's year is not shifted. Thank you!

• ###### 4. Re: Same period last year and this year

Yup, you got it! Glad it worked out for you!

• ###### 5. Re: Same period last year and this year

What if you want to base the calculation on the Max(Date) of your data rather than the current date 'Today()'?  I havent been able to do it because it does not like mixng aggregated calculations with non aggregates

• ###### 6. Re: Same period last year and this year

Hi John,

Instead of TODAY() you can use {MAX(Date)} by adding the curly brackets it will find the maximum date in the entire data source and return it as a disaggregated date.

Take care,

Keshia

1 of 1 people found this helpful
• ###### 7. Re: Same period last year and this year

Thank you Keshia, that helps very much!

Regards,

John