Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
JackRyan
Contributor
Contributor

Same weekday last year

I want to compare sales of Jan 2020 with Jan 2019 day by day but I want the same weekday for example 1/1/2020 Wednesday with 2/1/2019 which is also Wednesday. My master calendar has all the basic flags but I cant find the proper way to do it.

Labels (5)
1 Reply
petter
Partner - Champion III
Partner - Champion III

This should calculate the nearst weekday the previous year:

If the field that contains the date of the current year is called aDate:

Date(AddMonths(aDate,-12) + If(Mod(Year(aDate)-1,4)=0 AND Mod(Year(aDate)-1,100)<>0 OR Mod(Year(aDate)-1,400)=0 ,2,1 ))

If you have a field for the year corresponding to the year in aDate:

Date(AddMonths(aDate,-12) + If(Mod(aYear-1,4)=0 AND Mod(aYear-1,100)<>0 OR Mod(aYear-1,400)=0 ,2,1 ))