4 Replies Latest reply on Jul 31, 2017 7:27 PM by Tiago Valente

# How to find maximum number of days in a year (based on today's date)

Hi All,

I'm trying to define the maximum number of days in a year given today's date. I am trying to do this to make sure I don't treat a leap year as having 365 days.

In excel the formula would be:

=DATE(YEAR(A2),12,31)-DATE(YEAR(A2),1,1)+1

Where Cell A2 has your date.

I am struggling to replicate this in Tableau and would appreciate it if anyone can shed some light.

Cheers!

• ###### 1. Re: How to find maximum number of days in a year (based on today's date)

Hi, Tiago

Have you tried below calculation field?

ZZ

• ###### 2. Re: How to find maximum number of days in a year (based on today's date)

Thanks so much!

Why do I have to change the measure from Sum to average to see 365?

If it is at sum I see the value of 7,300

But it does work so thank you!

• ###### 3. Re: How to find maximum number of days in a year (based on today's date)

The reason is, the calculation is row based, so if you use sum, it will sum up all the value of 365 for each row.

ZZ