Visionmorgan
Visionmorgan

Reputation: 1

I'm trying to generate the week number in PowerBI for 2023 and its giving me incorrect figures

For instance week 1 for 2023 is 01/01/2023 to 07/01/202 which is wrong.

The correct week for week 1 of 2023 is 02/01/2023 to 08/01/2023

Screenshot of the calendar

1

Can someone please help?

I tried creating several times but to no avail

Upvotes: 0

Views: 2239

Answers (1)

Marcus
Marcus

Reputation: 3995

You can specify week systems in the WEEKNUM DAX function as an optional second argument.

The default for this optional parameter is system 1, where week 1 is the week that contains January 1st. System 2 sets week 1 as the week containing the first Thursday of the new year, which is ISO 8601 compliant.

Try this:

Week = WEEKNUM ( 'Date'[Date] , 2 )

If you are calculating this in Power Query, the calculation is much more complex, for some reason. See this link for a solution: https://datacornering.com/how-to-calculate-iso-week-number-in-power-query/

Upvotes: 1

Related Questions