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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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. It helps others in the community find answers faster—and keeps the community growing stronger!
You can also check out my YouTube channel for tutorials, tips, and real-world solutions in Power Query with the following link
https://youtube.com/@omidbi?si=96Bo-ZsSwOx0Z36h

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. It helps others in the community find answers faster—and keeps the community growing stronger!
You can also check out my YouTube channel for tutorials, tips, and real-world solutions in Power Query with the following link
https://youtube.com/@omidbi?si=96Bo-ZsSwOx0Z36h
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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors