Power Apps WeekNum and ISOWeekNum Function + Examples

While working on a Power Apps project Tracking Project Tasks, I got a requirement to filter the tasks based on the current week, previous week, and future weeks. So that they can easily track the tasks without facing any issues.

To achieve it, fortunately, Power Apps provides some functions called WeekNum() and ISOWeekNum().

In this Power Apps article, I will explain PowerApps weeknum, how to get PowerApps weeknum, and the PowerApps weekday function with examples.

Also, we will see the difference between weeknum and isoweeknum function, weekday powerapps, powerapps day of week, etc.

Power Apps WeekNum() Function

PowerApps Weeknum function retrieves the week number of a provided date. It calculates the beginning of the week number with January 1st as the first week of the year. The week number range is between 1 to 54.

PowerApps WeekNum Syntax:

WeekNum(DateTime,[StartOfWeek])
  • DateTime – It is a required parameter; based on this date, the function returns weeknumber.
  • StartOfWeek – It is an optional parameter that gets the week number based on the provided week name. For example, StartOfWeek.Monday, StartOfWeek.Tuesday, etc.

Look at the table below. We can provide the date in the WeekNum() function in various ways.

Date Week Number
WeekNum(1/1/2024)1
WeeNum(1/6/2024,StartOfWeek.Monday)1
WeekNum(“5/1/2024”, StartOfWeek.Thursday)18
WeekNum(DateValue(“Wednesday, January 24 ,2024”))4

Weeknum Power Apps Examples

Here, we’ll see a simple example of how to use the PowerApps WeekNum() function.

1. In Power Apps, click on the +Insert tab -> select Text Label to display the week number.

powerapps weeknum

2. Put the below formula in the Text property of the text label:

WeekNum(Today())

Here, Today() will provide the current date, to the WeekNum function. Inplace of Today(), you can provide any date value.

powerapps week number

3. In the image below, you can see the week number is displayed.

powerapps weeknumfunction

This is how to use the Weeknum function in Power Apps.

See also  Network error when using Patch function: Field 'Title' is required

Power Apps ISOWeekNum Function

PowerApps ISOWeekNum() function will provide the week number of the provided date, which is slightly different from the WeekNum() function. It follows the ISO 8601 date and time standard definitions for week numbering.

The result of this function ranges between 1 to 53. Sometimes, the function will display 52 or 53 for the 1st day of January. Since the date could belong to the last week of the previous year.

PowerApps ISOWeekNum Syntax:

ISOWeekNum(DateTime)

DateTime-it is a required parameter. The week always begins on Monday.

Power Apps ISOWeekNum Example

Follow the below steps to get the week number of the given date. Using ISOWeekNum() function.

1. Click +Insert tab in PowerApps->Select Text Label to display the week number using ISOWeekNum(). As in the above section.

2. Put the below formula in the Text property of the label.

ISOWeekNum(DateValue("Friday, January 1, 2023"))
isoweeknum Power Apps

3. Look at the image below; it displays the week number.

isoweeknum vs weeknum function

4. Whenever we provide the current date with the ISOWeekNum function, it displays the current week number, as shown below.

app in a day powerapps 

This is how we can use the ISOWeekNum function in Power Apps.

Difference Between WeekNum and ISOWeekNum

The WeekNum() function and ISOWeekNum() function in Power Apps display the week number of a given date.

However, they differ in how they calculate the first week of the year. Let’s see some differences in the table below.

WeekNum()ISOWeekNum()
This function calculates the week number based on the week starting on “Sunday.”This function calculates the week’s number based on ISO 8601 standards.
It considers the Sunday as the first day of the weekIt considers the first day of the week as the day falls on 1st January. It is like Monday, but according to the Gregorian year, it is considered a Thursday.
It is possible to consider the last few days of December as the first few days in January of the current year.In ISOWeekNum function consider it as different weeks only.

You can see the difference between those two functions visually in the example below. Here, Jan 1st fell on “Monday.” So, for every Monday, the ISOWeekNum() function changes the week number.

See also  How to Apply Conditional Formatting in Power BI Bar Chart?

But the WeekNum() function changes the week number for every “Sunday.” Finally, it shows the “December 31st, 2023” week number as 53. For ISOWeekNumFunction, it shows 52.

difference between Power Apps weeknum and isoweeknum

With this example, you’ll get clarity on the range differences.

To see the difference between WeekNum() and ISOWeekNum() visually. Follow the below steps.

1. In PowerApps, click the +Insert tab -> Select DatePicker. Again, select Text Labels two times for the WeekNum function and ISOWeekNum function.

powerapps weekday

2. Now, set the Text property of two text labels with the two formulas below individually.

"Weeknum(): "  & WeekNum(dte_DateTime.SelectedDate)

Here,dte_DateTime is my date picker name; you change this to your date picker name. So, the WeekNum function calculates the week number based on the selected date in the date picker.

To show the difference, I’m concatenating [&] the “Weeknum(): ” string to the WeekNum function return value.

weeknum power apps
"ISOWeekNum(): " &ISOWeekNum(dte_DateTime.SelectedDate)

Here, the ISOWeekNum() function returns the week number of the selected dates in the date picker.

weeknum vs isoweeknum Power Apps

That’s it. Now, start checking the week number from both functions, as shown in the starting example.

Power Apps WeekNum and ISOWeekNum Examples

In this section, we’ll see one real-time example of using the WeekNum function and ISOWeekNum functions in the Power Apps gallery.

I have a SharePoint list named Tracking Project Tasks with these many fields below:

Field NameData Type
Task NameTitle(Default)
Assigned ToPerson or Group
StartDateDate and Time
EndDateDate and Time
powerapp in a day

Here, I’m going to explain how to filter the tasks of the current week and previous and future weeks with the help of the Power Apps WeekNum and ISOWeekNum functions.

See also  Power Automate Remove Item from Array

Filter Current Week Tasks Using Power Apps WeekNum():

1. In the Items property of the PowerApps gallery, put the formula below.

Filter(col_Project,WeekNum(EndDate) = WeekNum(Today()))

Here, col_Project is the collection name, and EndDate is the SharePoint date column.

isoweeknum powerapps

2. Look at the example below; I have only one task in the current week. You can see the EndDate field “5/3/2024” is in the current week, and today’s date is 5/2/2024.

powerapps get week number

Filter Future Week Tasks Using Power Apps ISOWeekNum():

1. Provide the below formula on the Items property of the PowerApps gallery:

Filter(col_Project,ISOWeekNum(EndDate)>WeekNum(Today()))
iso week number and week number

2. In the reference example below, you can see the future tasks by observing the EndDate field.

iso week start day

Filter Previous Week Tasks Using Power Apps WeekNum():

1. Put the formula below in the Items property of the PowerApps gallery.

Filter(col_Project,WeekNum(EndDate) <= WeekNum(Today()))
iso week number starting sunday

2. In the example below, you can see only the previous tasks. Observe the EndDate field in the gallery.

powerapps iso week number today

This is how we can use WeekNum() and ISOWeekNum() functions in the real-time scenarios.

PowerApps WeekDay Function

The WeekDay() function in PowerApps displays the weekday number. For example, look at the table I have shown with the information for a weekday.

Week NameWeek Name
Sunday 1
Monday2
Tuesday3
Wednesday4
Thursday5
Friday6
Saturday7

Let’s see one example to get the weekday number of the provided date.

1. In PowerApps, select one Date picker and one Text label from the +Insert tab.

2. Now, set the Text property of the text label with the below formula.

Weekday(dte_DateTime.SelectedDate)

dte_DateTime = Power Apps Date picker

powerapps day of week

3. In the example below, you can see the weekday number of the selected date.

power apps weekday

I hope this article is related to your search. I have clearly explained the PowerApps WeekNum and ISOWeekNum functions and the difference between them. Also, we saw how to use Power Apps weekday function with some examples.

Moreover, you may like some articles below:

>