Get the First Day of the Week from any Week Number

To get the first day of the week from any week number in Power Apps we can use either the ISOWeekNum or WeekNum.

 

WeekNum vs ISOWeekNum

The formula below receives two inputs - year and weekNo - and outputs the day of the week. There are two approaches which yield slightly different results: using ISOWeekNum or WeekNum. The example below uses the ISOWeekNum function. 

 

  • WeekNum uses the week containing January 1 as the first week of the year. The result from this function can range from 1 to 54.

  • ISOWeekNum uses the week containing the first Thursday of the year as the first week of the year. This follows the ISO 8601 date and time standard definition for week numbering. The result from this function can range from 1 to 53. It is possible that 52 or 53 may be returned for the first days of January since the dates could belong to the last week of the previous year.

 

With({​​​​​​year:2021 , weekNo:35}​​​​​​​​​​​​​,
With({​​​​​​​​​​​​​weekDate:
      If(ISOWeekNum(Date(year,1,1)) < 1,
         DateAdd(Date(year,1,1), 7* (weekNo-1)),
         DateAdd(Date(year,1,1), 7* weekNo)
      )
      }​​​​​​​​​​​​​,
      DateAdd(weekDate,
        -(Weekday(weekDate,StartOfWeek.MondayZero)),
        Days
   )
 )
)