Week numbers are useful but not for everyone, I reckon. They represent the number of the week of the year starting at the beginning of the year, where Monday is the start of the week since we’re talking about the ISO version of the week number. So the number 1 week is the week that contains the first Thursday of the year. As a result, you can have 52 or 53, depending on the year. Power Apps provides the ISOWeekNum function to help us with this.
So let’s see how we can use it efficiently but, before we start, there’s a nice article from Microsoft explaining why and how the function was developed, and it’s quite interesting. You can find it here.
It follows a simple pattern where you provide a date, and it returns an integer com the week number.
ISOWeekNum(Today()) today is the 16th of August 2021, so it will return: 33
You need to provide a date to get the week number. Even if you provide a string with the correct date, you need to convert it to a valid date to get the week number.
Also, this won’t convert dates before the reference date, being the 1st of January 1900.
Weeks always start on Monday
If you need the week to start with another day you should use the WeekNum function.
Don’t nest it.
There’s no real reason to do it, but if you find yourself in a situation where you have nested ISOWeekNum functions in a formula, you should review it and make everything more straightforward.
Please note that formulas may have localization-based differences. For example, you should write “ISOWeekNum” with “,” separating each of the arguments, but if your regional settings are set to Portugal, you should use “ ;” instead.
ISOWeekNum functions in Power Apps
Back to the Power Apps Function Reference
Photo by Nick Hillier on Unsplash