Easter Sunday - Calculate for any given year (from 1600 to 2600)

Version 1

    Description:

     

    The following is a Tableau variable to calculate Easter Sunday for any given year.  The formula works from 1600 onwards and has been tested to 2600 although I believe that the formula will stop working at some point after 2600 due to complexities around Easter calculations.

     

     

     

     

    Example Calculation:

     

    //Calculation for Easter in any given year

    //Requires the year to be provided by the variable [Year]

     

    DATE(STR([Year]) + "-" + STR(1+((INT(((((19*(([Year] % 19))+(INT([Year]/100))-(INT(INT([Year]/100)/4))-(INT(((INT([Year]/100))-(INT(((INT([Year]/100))+8)/25))+1)/3))+15) % 30))+(((32+2*((INT([Year]/100) % 4))+2*(INT((([Year] % 100))/4))-(((19*(([Year] % 19))+(INT([Year]/100))-(INT(INT([Year]/100)/4))-(INT(((INT([Year]/100))-(INT(((INT([Year]/100))+8)/25))+1)/3))+15) % 30))-(((([Year] % 100)) % 4))) % 7))-7*(INT(((([Year] % 19))+11*(((19*(([Year] % 19))+(INT([Year]/100))-(INT(INT([Year]/100)/4))-(INT(((INT([Year]/100))-(INT(((INT([Year]/100))+8)/25))+1)/3))+15) % 30))+22*(((32+2*((INT([Year]/100) % 4))+2*(INT((([Year] % 100))/4))-(((19*(([Year] % 19))+(INT([Year]/100))-(INT(INT([Year]/100)/4))-(INT(((INT([Year]/100))-(INT(((INT([Year]/100))+8)/25))+1)/3))+15) % 30))-(((([Year] % 100)) % 4))) % 7)))/451))+114)/31))-1))+ "-" +STR(1+((((((((19*(([Year] % 19))+(INT([Year]/100))-(INT(INT([Year]/100)/4))-(INT(((INT([Year]/100))-(INT(((INT([Year]/100))+8)/25))+1)/3))+15) % 30))+(((32+2*((INT([Year]/100) % 4))+2*(INT((([Year] % 100))/4))-(((19*(([Year] % 19))+(INT([Year]/100))-(INT(INT([Year]/100)/4))-(INT(((INT([Year]/100))-(INT(((INT([Year]/100))+8)/25))+1)/3))+15) % 30))-(((([Year] % 100)) % 4))) % 7))-7*(INT(((([Year] % 19))+11*(((19*(([Year] % 19))+(INT([Year]/100))-(INT(INT([Year]/100)/4))-(INT(((INT([Year]/100))-(INT(((INT([Year]/100))+8)/25))+1)/3))+15) % 30))+22*(((32+2*((INT([Year]/100) % 4))+2*(INT((([Year] % 100))/4))-(((19*(([Year] % 19))+(INT([Year]/100))-(INT(INT([Year]/100)/4))-(INT(((INT([Year]/100))-(INT(((INT([Year]/100))+8)/25))+1)/3))+15) % 30))-(((([Year] % 100)) % 4))) % 7)))/451))+114) % 31))+1)-1)))

     

     

     

    Inputs and Setup:

    [Year] as an integer is required as the year to calculate Easter in e.g. "2017" or "YEAR(TODAY())"

        


    Comments:

    This function works from 1600 to 2600 and will stop working at some point beyond 2600

    This formula can also be used to work out Good Friday (Easter Sunday -2 days) and Easter Monday (Easter Sunday +1 day) for use as bank holidays (UK)

     

    Related Functions:

    Uses only standard tableau functions

    DATE - Used to create a date from a string

    INT - Used to provide integer (round down)

    STR - Used to convert integers to string

    % - Remainder function e.g.     The remainder of 9 divided by 2 would be:  9 % 2 = 1

     

    Further Reading/Examples:

    Tableau Public Dashboard using the function: Tableau Public

    My original thread post: https://community.tableau.com/thread/248669