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
googlogmob
Advocate II
Advocate II

WEEKNUM

Our company use such logic for week numers: http://prntscr.com/ejqqt0
If the last week of the year contains at least one day of the next year, we mark this last week as the first week of the new year
When i try to use WEEKNUM('Календарь'[Дата];21), the first week of year starts from 02.01.2017, but we need from 26.12.2016
http://prntscr.com/ejqrji

Is there any way to do such week numeration?

1 ACCEPTED SOLUTION
v-caliao-msft
Employee
Employee

Hi @googlogmob,

 

In your scneairo, you get that result because you use 21 parameter in your WEEKNUM function. If you want to get the expected result, please create the calculated column like below.
Year = YEAR('Table'[Date])
Weeknumber = WEEKNUM('Table'[Date],2)
Weeknumber2 = IF(CALCULATE(COUNT('Table'[Weeknumber]),ALLEXCEPT('Table','Table'[Year],'Table'[Weeknumber]))<7,1,'Table'[Weeknumber])

Capture.PNG

 

Regards,

Charlie Liao

View solution in original post

2 REPLIES 2
v-caliao-msft
Employee
Employee

Hi @googlogmob,

 

In your scneairo, you get that result because you use 21 parameter in your WEEKNUM function. If you want to get the expected result, please create the calculated column like below.
Year = YEAR('Table'[Date])
Weeknumber = WEEKNUM('Table'[Date],2)
Weeknumber2 = IF(CALCULATE(COUNT('Table'[Weeknumber]),ALLEXCEPT('Table','Table'[Year],'Table'[Weeknumber]))<7,1,'Table'[Weeknumber])

Capture.PNG

 

Regards,

Charlie Liao

Hi @v-caliao-msft

It works!

 

Thank You! )

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.