September 24, 2021

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.

Usage

It follows a simple pattern where you provide a date, and it returns an integer com the week number.

Example:

ISOWeekNum(Today())

today is the 16th of August 2021, so it will return:

33

Limitations

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.

Recommendations:

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.

Localization

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.

Sources:

 ISOWeekNum functions in Power Apps 

Back to the Power Apps Function Reference

Photo by Nick Hillier on Unsplash

Manuel Gomes

I'm a Project Manager with experience in large projects and companies. I've worked in the past for companies like Bayer, Sybase (now SAP) and I'm currently working for Pestana Hotel Group.

View all posts by Manuel Gomes →

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: