Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
NochWyn
Frequent Visitor

Change WEEKNUM start

I need to figure out how to alter the week calculation to not be dependent on starting on Sunday or Monday, but on January 1 every year. For example, January 7 should always be the last day of the first week, and January 8 would always be the first day of the second week. Any ideas will be appreciated.

1 ACCEPTED SOLUTION
ibarrau
Super User
Super User

Hi. The easiest way I figure out right now is adding a new custom column with Power Query in the same table that has the Date Column. The code should be like this:

Number.RoundUp(Date.DayOfYear([Fecha]) / 7)

Hope this help.

Regards,

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Happy to help!

LaDataWeb Blog

View solution in original post

4 REPLIES 4
ibarrau
Super User
Super User

Hi. The easiest way I figure out right now is adding a new custom column with Power Query in the same table that has the Date Column. The code should be like this:

Number.RoundUp(Date.DayOfYear([Fecha]) / 7)

Hope this help.

Regards,

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Happy to help!

LaDataWeb Blog

@ibarrau, thank you for the suggestion! Your solution triggered the idea to just use the round function directly in Power BI > Modeling > New Column.

 

Week = ROUNDUP( Dates[DayNoOfYear] / 7, 0 )
 
And I get day number of year [DayNoOfYear] from:
 
DayNoOfYearDATEDIFF ( DATE ( YEAR ( Dates[Date] ), 1, 1 ), Dates[Date], DAY ) + 1
 

Great! did the post solve your problem? if so, please mark it as solution, if not please let me know how can I continue helping you 🙂

 

Regards,


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Happy to help!

LaDataWeb Blog

RobbeVL
Impactful Individual
Impactful Individual

Hi,

 

If you create a custom Date Dimension, you can configure it as you wish.

Hope this helps? 

https://aleson-itc.com/creando-dimdate-en-power-bi-serie-dimdate-1-3/

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.