Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Calculate Easter Dates

Hi!

Is there a way to calculate automatically Easter dates for every year (in past and in future)?

Thanks!

Labels (1)
6 Replies
rwunderlich
MVP
MVP

It may be possible to build the calculation in the script.  Or iIf you just need the actual dates, you can download them from a site on the web. Google "Easter dates" and find a suitable source.

-Rob

marcus_sommer
MVP
MVP

Take a look here: Master Calendar with movable holidays which includes a calculation of the easter dates.

- Marcus

amonjaras_c40
Luminary
Luminary

Hello Marcus and everyone! The link to the Master Calendar with movable holidays is dead now. Can we find it somewhere else?

Thanks!

marcus_sommer
MVP
MVP

@Sue_Macaluso - please make my previous blog-postings accessible again. Many thanks.

HoS1
Contributor III
Contributor III

Gaël
Contributor III
Contributor III

While this thread is old, the main question remains. I implemented the algorithm described in http://www.oremus.org/liturgy/etc/ktf/app/easter.html below.
If your goal is to compute net working days, you could add indicators for weekends and public holidays in a Master Calendar, and compute the sum of these days between the dates of interest.

 

// Compute Easter Sunday. Apparently, QLik Sense does not provide this info.
//
// Useful links
// https://www.oremus.org/liturgy/etc/ktf/app/easter.html
// https://almanac.oremus.org/easter/computus/
// https://help.qlik.com/en-US/qlikview/April2020/Subsystems/Client/Content/QV_QlikView/Scripting/dollar-sign-expansion-using-parameters.htm



// We refer to the year number as y (or $1), and use it to calculate the
// g: Golden number
Set GoldenNumber = '(Mod($1, 19) + 1)';

// s: solar correction
// l: lunar correction
Set SolarCorrection= 'Floor(($1-1600)/100) - Floor(($1-1600)/400)';
Set LunarCorrection = 'Floor(((Floor(($1-1400)/100))*8)/25)';

// p': Next we calculate the date of the Paschal full moon, that is, the full moon which Easter is the Sunday after. This is done in several stages.
Set Paschal_uncorr = 'Mod(3 - 11*$(GoldenNumber($1)) + $(SolarCorrection($1)) - $(LunarCorrection($1)), 30)';

// p: Paschal full moon (as the number of days after 21st March)
// apply a minor correction to get the exact date of the Paschal full moon (as the number of days after 21st March)
Set Paschal = 'If($(Paschal_uncorr($1)) = 29 or ($(Paschal_uncorr($1)) = 28 and $(GoldenNumber($1)) > 11), $(Paschal_uncorr($1))-1, $(Paschal_uncorr($1)))';

// d: calculate the 'Dominical number'
// Note that this is the number from which the Dominical letter is determined
Set DominicalNumber = 'Mod($1 + Floor($1/4) - Floor($1/100) + Floor($1/400),7)';

// d': which is the date on which the first Sunday of the year falls
Set FirstSunday = 'Mod(8-$(DominicalNumber($1)), 7)';

// p'': the first date in the year which falls on the same day of the week as the Paschal full moon.
Set FirstDay = 'Mod(31 + 28 + 21 + $(Paschal($1)), 7)';

// x = difference between d' (the first Sunday in the year) and p'' (the day of the week when the Paschal full moon falls)
// with minor correction so that x falls within the range 1-7 instead of 0-6
Set SundayDiff = '(Mod($(FirstSunday($1)) - $(FirstDay($1)) - 1, 7) + 1)';

// number of days Easter falls after 21st March:
Set EasterOffset = '$(Paschal($1)) + $(SundayDiff($1))';

Set Easter = 'Date(MakeDate($1, 3, 21) + $(EasterOffset($1)))';


Let y = Year(Today());
Let g = $(GoldenNumber(Year(Today())));
Let s = $(SolarCorrection(Year(Today())));
Let l = $(LunarCorrection(Year(Today())));
Let p_prime = $(Paschal_uncorr(Year(Today())));
Let p = $(Paschal(Year(Today())));
Let d = $(DominicalNumber(Year(Today())));
Let d_prime = $(FirstSunday(Year(Today())));
Let p_dblprime = $(FirstDay(Year(Today())));
Let x = $(SundayDiff(Year(Today())));
Let e = $(EasterOffset(Year(Today())));

Let Easter_2024 = $(Easter(Year(Today())-1));
Let Easter_ThisYear = $(Easter(Year(Today())));
Let Easter_2026 = $(Easter(2026));
Let Easter_2027 = $(Easter(2027));
Let Easter_2028 = $(Easter(2028));
Let Easter_2029 = $(Easter(2029));

trace >>> Year = $(y);
trace >>> GoldenNumber($(y)) = $(g);
trace >>> SolarCorrection($(y)) = $(s);
trace >>> LunarCorrection($(y)) = $(l);
trace >>> Paschal_uncorr($(y)) = $(p_prime);
trace >>> Paschal($(y)) = $(p);
trace >>> DominicalNumber($(y)) = $(d);
trace >>> FirstSunday($(y)) = $(d_prime);
trace >>> FirstDay($(y)) = $(p_dblprime);
trace >>> SundayDiff($(y)) = $(x);
trace >>> EasterOffset($(y)) = $(e);
trace >>> Easter(2024) = $(Easter_2024);
trace >>> Easter($(y)) = $(Easter_ThisYear);
trace >>> Easter(2026) = $(Easter_2026);
trace >>> Easter(2027) = $(Easter_2027);
trace >>> Easter(2028) = $(Easter_2028);
trace >>> Easter(2029) = $(Easter_2029);

Let y = NULL();
Let g = NULL();
Let s = NULL();
Let l = NULL();
Let p_prime = NULL();
Let p = NULL();
Let d = NULL();
Let d_prime = NULL();
Let p_dblprime = NULL();
Let x = NULL();
Let e = NULL();
Let Easter_2024 = NULL();
Let Easter_ThisYear = NULL();
Let Easter_2026 = NULL();
Let Easter_2027= NULL();
Let Easter_2028 = NULL();
Let Easter_2029 = NULL();