Get the date of a weekday in the first/second/third or fourth week in any year

Since for some holidays or events it is not a fixed date but rather dynamic as a weekday of a certain number of week in a month, I was trying to figure out an expression for this and came up with one. I figured out I could save you some time by sharing it:

 

DATE(
CONCATENATE(
		[desired_month_number],
		"/",
		1,
		"/",
		[desired_year]
		)
	)
  +(7*[week_number_in_a_month])
  -
  WEEKDAY(
  	DATE(
	  CONCATENATE(
		[desired_month_number],
		"/",
		1,
		"/",
		[desired_year]
			)
		)
	)
  +
  [desired_week_day]+1

 

 

* [week_number_in_a_month]: could be 1,2,3 or 4 as in 1st, 2nd and so on.

* [desired_month_number]: Number in the year of the month you're trying to find

* [desired_year]: year you're trying to find

* [desired_week_day]: weekday of the day youโ€™re trying to find. Monday=1โ€ฆ Sunday=7

2 0 102
0 REPLIES 0
Top Labels in this Space