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
Pikachu-Power
Post Prodigy
Post Prodigy

WEEKNUM (for the beginning of the year)

Hello,
 
WEEKNUM(Calender[Date], 2) gives for the CW1 the dates 01.01. / 02.01. / 03.01. But actually these dates belongs to CW53. CW1 should start at 04.01.
 
What is the reason for that? The other functions in Power BI respect that fact. And is that adjustable?
 
thanks.
1 ACCEPTED SOLUTION
themistoklis
Community Champion
Community Champion

@Pikachu-Power 

 

Change the formula to the following one:

WEEKNUM('Calendar'[Date], 21)
 
Instead of 2 use 21. Although 21 is not available in the documentation, it is a valid parameter in formula

View solution in original post

4 REPLIES 4
themistoklis
Community Champion
Community Champion

@Pikachu-Power 

 

Change the formula to the following one:

WEEKNUM('Calendar'[Date], 21)
 
Instead of 2 use 21. Although 21 is not available in the documentation, it is a valid parameter in formula

hi themistoklis,

 

yes thats work. but in combination with the year i get following problem:

 

1.PNG

 

normally the CW53 should belong the year 2020. Something like YEAR(calender(date), 21) would be nice 🙂

 

for my x-axis i use:

 

YEAR_CW = IF(WEEKNUM(Calender[Date],21) < 10, YEAR(Calender[Date])&"_"&0&WEEKNUM(Calender[Date],21), YEAR(Calender[Date])&"_"&WEEKNUM(Calender[Date],21))
 
so I get the shift describeb above. some ideas to get rid of this problem?

Here is a solution from 2016:

Solved: Need help creating week number - Microsoft Power BI Community

Is it still current?

@Pikachu-Power 

I think this formula may help you.

 

Year = IF(WEEKNUM('Calendar'[Date], 21)=53, YEAR('Calendar'[Date]) - 1, YEAR('Calendar'[Date]))

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.