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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
chrismoncrief
Frequent Visitor

date.weekofyear by field

I am trying to create a column that records the week number based on the date found in another column.

Below is a screenshot of what i am trying to accomplish.  The column that I have the date stored in is circled in red, and I am trying to get the column "week" to return the week number for the "Date Counted" field.

 

chrismoncrief_0-1734638871133.png

 

2 ACCEPTED SOLUTIONS
Omid_Motamedise
Super User
Super User

hi @chrismoncrief 

As @jgeddes mention, use Date.WeekOfYear([Date Counted]), if it doesnot solve your problem, use this one

 

Date.WeekOfYear(Date.From([Date Counted]))


If my answer helped solve your issue, please consider marking it as the accepted solution.

View solution in original post

ZhangKun
Super User
Super User

1. Remove #date() and change it to Date WeekofYear([Date Counted])
2. The Date.WeekofYear function returns a numerical value, not a date, so type date should not be used at the end of line 15. You can use type number or Int64.Type (if you want it to be an integer)

View solution in original post

3 REPLIES 3
ZhangKun
Super User
Super User

1. Remove #date() and change it to Date WeekofYear([Date Counted])
2. The Date.WeekofYear function returns a numerical value, not a date, so type date should not be used at the end of line 15. You can use type number or Int64.Type (if you want it to be an integer)

Omid_Motamedise
Super User
Super User

hi @chrismoncrief 

As @jgeddes mention, use Date.WeekOfYear([Date Counted]), if it doesnot solve your problem, use this one

 

Date.WeekOfYear(Date.From([Date Counted]))


If my answer helped solve your issue, please consider marking it as the accepted solution.
jgeddes
Super User
Super User

Does Date.WeekOfYear([Date Counted]) without the #date() wrapper fix your error?





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

Proud to be a Super User!





Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.