1 Reply Latest reply on Jun 16, 2011 11:07 AM by Joe Mako

    DATEPART('month', date) vs. MONTH(date)

    Zach Leber

      Is there a reason to use DATEPART() instead of the simpler MONTH(), DAY(), and YEAR() which are easier to read?  I understand that DATEPART can also extract hours, minutes, and seconds.

        • 1. Re: DATEPART('month', date) vs. MONTH(date)
          Joe Mako

          My thought would be that as with many things in Tableau, there is more than one method to accomplish the same thing, so the reason to use one over the other is just a preference. I like having multiple options.


          I like to use DATEPART in formulas that also use DATEADD or DATENAME because each of these functions have a similar structure, so I feel like I can see all the arguments in each situation with a glance. If the formula is just a single line and simple, I will likely instead use MONTH/DAY/YEAR.