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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Fardy
Frequent Visitor

Create column Date N-1 based on week ISO

Hello everyone,

 

I'm creating a date table with a 'Date' column and I want to add a 'Date N-1' column corresponding to the same day (Monday, Tuesday, Wednesday...) of the same week of the previous year.

For example, if I take Wednesday May 1, 2024, I want Wednesday May 3, 2023.

I work with week in ISO format.

 

Thank you

1 ACCEPTED SOLUTION

Hi @v-zhouwen-msft

 

Thanks for your reply, but this formula won't work in 2025, as my screenshot shows.

 

Fardy_0-1714719959213.png

 

I've found an alternative solution which consists in creating my date table with these two columns in a csv file instead of generating it with M or DAX.

View solution in original post

2 REPLIES 2
v-zhouwen-msft
Community Support
Community Support

Hi @Fardy ,

Please follow these steps:
1. Use the following DAX expression to create a column

Date N-1 = 
VAR _a = WEEKNUM([Date],2)
VAR _b = WEEKDAY([Date],2)
VAR _c = DATE(YEAR([Date])-1,1,1) + (_a-1) * 7 + _b
RETURN _c

2.Final output

vzhouwenmsft_0-1714704891222.png

 

Hi @v-zhouwen-msft

 

Thanks for your reply, but this formula won't work in 2025, as my screenshot shows.

 

Fardy_0-1714719959213.png

 

I've found an alternative solution which consists in creating my date table with these two columns in a csv file instead of generating it with M or DAX.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.