โญ Support Time.now: Join our Premium Plan for an ad-free experience! โญ Support Us: Go Premium Ad-Free!

Week numbers in Power BI (DAX)

To get the current ISO 8601 week number in Power BI (DAX), use the following code snippet:

WEEKNUM('Table'[DateColumn], 21) -- 21 specifies ISO 8601

* Ensure your system or application regional settings are set to follow ISO 8601 standards (weeks start on Monday) if the output varies.

Step-by-Step Instructions

  1. Create a calculated column or measure.
  2. Use WEEKNUM('Table'[DateColumn], 21): return type 21 selects ISO 8601 numbering.
  3. For a matching ISO year column, use the year of the week's Thursday: YEAR([DateColumn] + 4 - WEEKDAY([DateColumn], 2)).

Good to Know

WEEKNUM's default return type (1) is the US system. DAX has no ISOYEAR function, hence the Thursday trick; without it, weekly charts double-count the week that straddles New Year.