To calculate an ISO 8601 week number in Power Automate, find the Thursday of the date’s Monday-based week, take that Thursday’s year as the week-year, and count weeks from the Monday of the week containing January 4. The final value can then be formatted as YYYY-Www, where the year comes from ISO rules rather than necessarily from the calendar year of the original date.
That distinction matters around New Year. A date in early January can belong to the previous ISO week-year, while a date in late December can belong to the next one. The approach below uses explicit ISO rules instead of assuming that every regional or Sunday-based week-number setting follows ISO 8601.

The ISO rules your flow must reproduce
ISO weeks begin on Monday. Week 1 is the week that contains January 4, which is equivalent to the week containing the first Thursday of the year. The Thursday establishes the ISO week-year because it always falls in the middle of the relevant ISO week.
This rule set produces two important behaviors. First, the week-year is not always the same as the calendar year printed on the selected date. Second, an ISO week-year may contain a W53 label. A flow that clamps the result to 52 weeks will therefore be incomplete.
| Week convention | How weeks begin | How the year is assigned | Where it is commonly used |
|---|---|---|---|
| ISO 8601 | Monday | Week 1 contains January 4; the week-year follows the week’s Thursday | Standards-based filenames, reporting, planning, and agreed technical formats |
| Sunday-start or locale-based | Often Sunday, depending on the system | May use a different first-week rule or number calendar weeks from January 1 | Regional calendars and business schedules |
| Fiscal calendar | Defined by the organization | May follow a fiscal year, partial periods, or another numbering policy | Internal budgets, payroll periods, and financial reporting |
| Retail 4-4-5 calendar | Defined by the retailer | Uses merchandising periods rather than ISO week numbering | Some retail planning and inventory systems |
For a broader overview of the differences between these approaches, see timeanddate’s guide to week-number rules. The important operational point is that the convention must be agreed before the number is used in a file name, report, deadline, or downstream API.
Calculate the ISO week in a Power Automate flow
The following cloud-flow pattern uses a trigger field named Date. Replace triggerBody()['Date'] with the expression that returns your actual source date. Prefer a date-only value in YYYY-MM-DD form when the source represents a calendar date rather than an instant in time.
- Add a trigger that supplies the date. Open the flow and choose a trigger such as a scheduled trigger, a mail trigger, or another event that includes a date field. Confirm that the date field contains the business date you intend to number.
- Add a Compose action named IsoMonday. Open its expression editor and enter @startOfWeek(triggerBody()['Date'], 'Monday'). This locates the Monday that begins the selected date’s week. Later calculations reference this Compose by its exact name, so the capitalization matters.
- Add a Compose action named IsoThursday. Enter @addDays(outputs('IsoMonday'), 3). The Thursday is the decisive date for assigning the ISO week-year.
- Add a Compose action named IsoYear. Enter @year(outputs('IsoThursday')). Using the Thursday’s year prevents an early-January date from being assigned to the wrong ISO year and lets a late-December date move into the next ISO year when required.
- Add a Compose action named IsoFirstMonday. Enter @startOfWeek(concat(string(outputs('IsoYear')), '-01-04T00:00:00Z'), 'Monday'). This constructs January 4 of the calculated ISO year and finds the Monday of its week. The Monday start reflects the ISO rule that every week begins on Monday.
- Initialize an integer variable named IsoWeekNumber. Add the “Initialize variable” action, choose Integer as its type, and enter @add(div(sub(tick(outputs('IsoMonday')), tick(outputs('IsoFirstMonday'))), 6048000000000), 1) as the value. The tick difference counts complete seven-day blocks between the first Monday of the ISO year and the selected Monday. Dividing by the number of ticks in one week and adding one produces the ISO week number.
- Add a Compose action named IsoWeekLabel. Enter @concat(formatDateTime(outputs('IsoThursday'), 'yyyy'), '-W', formatNumber(variables('IsoWeekNumber'), '00')). This produces the standard label shape, including a two-digit week number such as W01 through W53.
- Use the label in later actions. Reference @{outputs('IsoWeekLabel')} in a Compose, condition, file name, SharePoint field, database value, or other destination. If only the numeric week is needed, reference @{variables('IsoWeekNumber')} instead.
- Test the flow with boundary dates. Run the flow before putting it into production. Verify a normal first week, a January date that belongs to the prior ISO year, a December date that belongs to the next one, and an ISO year that contains 53 weeks. Comparing the flow’s YYYY-Www output with an independent calculator helps catch action-name, date-field, or expression mistakes.
If the trigger supplies a full timestamp, first confirm which calendar date represents the intended business event. A timestamp can carry an offset, and converting it before the week calculation may move the selected day. The ISO calculation should receive the same intended Gregorian date that the surrounding business process considers authoritative.
Use the Week Number Calculator for a fixed date or validation
The Week Number Calculator is useful when the date is already known or when you need an independent check on a Power Automate expression. Its supported workflow is local and manual; the verified product contract does not describe a Power Automate connector or an automatically updating feed from a trigger.
- Choose or enter the valid Gregorian date. Use a strict YYYY-MM-DD value for consistency with the flow input.
- Select Calculate ISO week. The calculator validates the date and applies the ISO Monday, January 4, Thursday, and week-year rules.
- Copy the returned YYYY-Www label. Use it directly only where ISO 8601 week rules are required. The result also includes the Monday-based weekday number, with Monday equal to 1 and Sunday equal to 7.
- Initialize a string variable in Power Automate. For a fixed date, create a String variable such as IsoWeekLabel and paste the calculator’s label as its value. Reference @{variables('IsoWeekLabel')} in later actions.
- Replace the value when the date changes. A pasted label is tied to the date used in the calculator. It will become stale in a recurring flow unless it is recalculated for each new source date.
The calculator performs its calendar arithmetic locally in UTC, so browser time zones and daylight-saving changes do not shift the selected date. That makes it a stable reference for checking a flow, but it does not make the pasted value dynamic.
Check New Year and 53-week behavior
Cross-year testing should focus on the Thursday rule, not just the calendar-year number. A date can be printed in December while its ISO week belongs to the following year. Similarly, a January date can sit in the final week of the previous ISO year. These are valid results rather than calculation errors.
For one worked example, take 2016-01-01. Its Monday-based week begins on 2015-12-28, so the week’s Thursday is 2015-12-31 and the ISO week-year is 2015. The first ISO week of 2015 began on 2014-12-29. Counting complete seven-day blocks from that Monday to 2015-12-28 gives 52 blocks, so adding one produces week 53. The correct label is therefore 2015-W53.
The calculator’s checked boundary cases include ordinary first weeks, New Year Sundays, dates assigned to a previous or next ISO year, and multiple 53-week years. Use those checks as a model for the test set in your own flow.
Match the convention before using the result
ISO output is appropriate for standards-based filenames, agreed reporting categories, planning, and development work where every participant uses ISO 8601. It is not automatically the correct answer for Sunday-start schedules, partial first weeks, locale-specific numbering, or fiscal calendars.
Payroll, tax, legal deadlines, fiscal reporting, and vendor APIs require particular caution. Ask the system owner for its exact definition: the first day of the week, the rule for week 1, the week-year boundary, and whether the expected value is a number or a label such as 2025-W01. If the answer differs from ISO, use that system’s convention rather than forcing the ISO result into the workflow.
Troubleshoot common week-number problems
- The calendar year and week-year disagree. Check that the flow derives the year from the week’s Thursday, not directly from the original date.
- The result is one week too high or low. Confirm that the first week contains January 4, that weeks begin on Monday, and that the count begins at the Monday of that week rather than at an arbitrary Sunday.
- W53 becomes W52. Do not cap the result at 52. Some ISO week-years contain 53 Mondays and therefore require the W53 label.
- The source date moves unexpectedly. Check whether the flow is using a full timestamp when a date-only value was intended. The calculator’s UTC arithmetic protects its own selected date, but it cannot correct an incorrect date supplied to the flow.
- An invalid date is accepted or interpreted differently. The calculator accepts a strict Gregorian YYYY-MM-DD value and visibly rejects impossible dates such as 2023-02-29. Validate the trigger field before calculation.
- The output loses its intended type. Use an Integer variable for the week number and a String or Compose value for YYYY-Www. Do not substitute a general locale-based week number for an ISO label without confirming the convention.
Related reading: Day of the Week Calculator for Beginners.