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
Anonymous
Not applicable

Beginning of the Week

Hello,

I'm trying to creat a column that will contains the date of the previous monday according to my column Date.

For exemple, if i got sunday 15 october 2019 i would like to have monday 9 october 2019

If I have monday 19 october 2022 I would like to keep this date.

I tried to use a DateAdd but it only show the date contains in my column date.

I also try with a weekday, weeknum and year but I don't know how to creat a new date with those informations.

If someone can help me it would be very nice.

Thank you

1 ACCEPTED SOLUTION
Samarth_18
Community Champion
Community Champion

Hi @Anonymous 

 

You can create a column with below code:-

Last_Monday = CALENDER_TABLE[Date] - WEEKDAY(CALENDER_TABLE[Date],2)+1

Samarth_18_0-1627483068106.png

Thanks,

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

View solution in original post

4 REPLIES 4
Samarth_18
Community Champion
Community Champion

Hi @Anonymous 

 

You can create a column with below code:-

Last_Monday = CALENDER_TABLE[Date] - WEEKDAY(CALENDER_TABLE[Date],2)+1

Samarth_18_0-1627483068106.png

Thanks,

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Anonymous
Not applicable

Thank you! 

Greg_Deckler
Super User
Super User

@Anonymous Try something like:

Column = 
  VAR __Date = [Date]
  VAR __MinDate = [Date] - 7
  VAR __Calendar = ADDCOLUMNS(CALENDAR(__MinDate, __Date),"__Weekday",WEEKDAY([Date],2))
  VAR __MaxMonday = MAXX(FILTER(__Calendar,[__Weekday] = 1),[Date])
RETURN
  __MaxMonday


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Thank you!

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.