3 Replies Latest reply on May 16, 2017 8:24 AM by Arthur Figueiredo

# How to calculate one day last month and last year?

Hello everyone.

I'm new in Tableau and I'm starting to develope some dashboards. I'm creating a workbook with informations from yesterday, one week ago, onde month ago and one year ago. The problem is that I need just one day , not the holl moth or year.

Example:

- for yesterday, I'm using a calculated field = today ()-1

- for one week ago = today ()-8

Problem:

- for the month, I'm using = today ()-31 ... the problem is that some months have 30 or 31 days, so the formula will not show "yesterday last month"

- the same problem for the year, that I'm using = today ()-366 ... trying to find "yesterday last year"

Could anyone help find a way to calculate "yesterday last month" and "yesterday last year"?

If I was not clear, let me know.

Best Regards.

Arthur.

• ###### 1. Re: How to calculate one day last month and last year?

Hi Arthur,

here is my approach:

Last Month = DATEADD('month', -1, TODAY())

Hope this helps.

~Tushar

2 of 2 people found this helpful
• ###### 2. Re: How to calculate one day last month and last year?

Here is a workbook with all kinds of date magic... (v 10.2)

• ###### 3. Re: How to calculate one day last month and last year?

Hi Tushar,