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
siros92
Frequent Visitor

week + year in seperate columns to date

Hi all! 

 

My dataset, which cannot be changed has two seperate columns to describe date; one [week] and one [year]. As the dataset spans over several years this naturally causes quite a bit of issues when trying to filter the data.

Is there any way to use power query to make the two columns into a new one which power bi will recognize as a validdate? 

Making date into the first day of week would be perfectly acceptable. 

 

Br

Frivik

 

 

1 ACCEPTED SOLUTION
avatorl
Impactful Individual
Impactful Individual

Add custom column Date with formula 

=Date.StartOfWeek(Date.AddDays(#date([year],1,1),([week]-1)*7),Day.Monday)



#date([year],1,1) returns January 1st of the [year],
then you add 7 days for each week using Date.AddDays
then you get first day of week using Date.StartOfWeek

View solution in original post

2 REPLIES 2
avatorl
Impactful Individual
Impactful Individual

Add custom column Date with formula 

=Date.StartOfWeek(Date.AddDays(#date([year],1,1),([week]-1)*7),Day.Monday)



#date([year],1,1) returns January 1st of the [year],
then you add 7 days for each week using Date.AddDays
then you get first day of week using Date.StartOfWeek

And you sir are a genious. Thanks for helping out a newbie! 

Enjoy your weekend. 

Best regards

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
Top Kudoed Authors