Calculation Series: How to find Last day of the current month, Last day of the previous month, and the Last day of the next month.

Vignesh Suresh
2 min readSep 21, 2024

--

In this blog, I will be showing you how to create Calculations for Last day of the current month, Last day of the previous month and Last day of the next month.

Last day of the Current Month

This requires 3 steps. They are as follows:-

  1. We first use DATETRUNC() at the month level with TODAY(), giving us the current month’s first day.
  2. Use DATEADD to deduct a day from the current month’s first day. We get Last day of the Previous Month.
  3. Use DATEADD to add a month to the calculated Last day of the Previous Month. The calculation looks like as shown below.

Last day of the Previous Month

This requires 2 steps. They are as follows:-

  1. We first use DATETRUNC() at the month level with TODAY(), giving us the current month’s first day.
  2. Use DATEADD to deduct a day from the current month’s first day. We get Last day of the Previous Month. The calculation looks like as shown below.

Last day of the Next Month

This requires 3 steps. They are as follows:-

  1. We first use DATETRUNC() at the month level with TODAY(), giving us the current month’s first day.
  2. Use DATEADD to deduct a day from the current month’s first day. We get Last day of the Previous Month.
  3. Use DATEADD to add 2 months to the calculated Last day of the Previous Month. The calculation looks like as shown below.

Hope you found the tutorial helpful.

Thank you for reading. Connect with me on Twitter and LinkedIn, and check out my Tableau Public profile for more visualizations.

Vignesh Suresh

--

--

Vignesh Suresh
Vignesh Suresh

Written by Vignesh Suresh

A Tech Lover, Tableau Enthusiast

No responses yet