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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
SJHA
Helper I
Helper I

First date of the week from year and week number

Hello,

I hope you can help me out. I've been searching and trying to find a way.

 

I have a column with "year" and one with "week number" - I need a column with the first day of week.

 

SJHA_0-1598965222689.png

 

It seems so simple, but it bugs my mind.

 

Hope you can help,

Sandi

1 ACCEPTED SOLUTION

@amitchandak 

 

SJHA_0-1598966473537.png

It only accepts the caculated measures. I did check for data type to be Date/Time

SJHA_1-1598966619334.png

 

 

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

@amitchandak 

 

higorterra_0-1603288340214.png

Could you help me? I don't get to finish

amitchandak
Super User
Super User

@SJHA , Try Monday Week start

 

Week to Date = var _st = date([year],1,1)
var _week = [Weeknumber]
Return _st+((_week-1)*7) -WEEKDAY(_st,2)+1

 

//Sunday Week Start

Week to Date = var _st = date([year],1,1)
var _week = [Weeknumber]
Return _st+((_week-1)*7) -WEEKDAY(_st,1)+1

 

refer : https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak  Hello again

 

I ran into this problem:

SJHA_0-1607333943257.png

 

The week 53 is causing a challenge. Do you know a quick fix to this logic?

@amitchandak 

 

SJHA_0-1598966473537.png

It only accepts the caculated measures. I did check for data type to be Date/Time

SJHA_1-1598966619334.png

 

 

@SJHA , you need to create that as new column. The name is yearnumber in your case

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak  I changed the data type to whole numbers and somehow that works with the code you provided.

 

Thank you so much! You've made my day, if not a whole week!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.