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
kjssdca
Regular Visitor

WEEKNUM - Every 10th week is 6 digits

Created a Dates table that includes a column for Week Number using DAX WEEKNUM function. Most of the data is correct, however for some reason every 10th week is showing up as 6-digit numbers that increment for each day of that week. This is the case for week numbers 10, 20, 30, 40 and 50. In example below, 143527 is Sunday, 143528 is Monday, etc. of week number 10. I tried changing data format for Week column from Text to Whole Number and even deleted and re-created the table, but still having the issue. Does anyone know how to fix this?

 

WEEKNUM every 10th week.PNG

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@kjssdca ,

Do not use format in that column. You only need Weeknum([Date],1)

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@kjssdca ,

Do not use format in that column. You only need Weeknum([Date],1)

Okay, removing FORMAT worked - Thanks @amitchandak !

WEEKNUM every 10th week - fixed (no FORMAT).PNG

@kjssdca , Please mark the solution

camargos88
Community Champion
Community Champion

Hi @kjssdca ,

 

Try this code:

 

D = ADDCOLUMNS(CALENDAR(TODAY()-180; TODAY()); "Year"; FORMAT([Date]; "yyyy"); "Month"; FORMAT([Date]; "mmm"); "Week"; WEEKNUM([Date]; 1))
 
I reproduced your code and I think the weeknum function inside function makes the return wrong. Try this code without format the week.
 
Ricardo


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



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.

Top Solution Authors