cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
NochWyn Frequent Visitor
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

Accepted Solutions
Super User II
Super User II

Re: Change WEEKNUM start

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.

Proud to be a Super User!

LaDataWeb Blog


View solution in original post

4 REPLIES 4
Super User I
Super User I

Re: Change WEEKNUM start

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/

Super User II
Super User II

Re: Change WEEKNUM start

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.

Proud to be a Super User!

LaDataWeb Blog


View solution in original post

NochWyn Frequent Visitor
Frequent Visitor

Re: Change WEEKNUM start

@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
 
Super User II
Super User II

Re: Change WEEKNUM start

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.

Proud to be a Super User!

LaDataWeb Blog


Helpful resources

Announcements
Exclusive LIVE Community Event #3 – Ask Arun Anything

Exclusive LIVE Community Event #3 – Ask Arun Anything

Join us in the third Triple A event!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors