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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Reimer
Helper II
Helper II

Next monday

I would like a new calculated column date as follows: if today is monday, keep it. If not return the next monday. 

 

Ive tried this:

NextMonday = DATEADD(Dates[Date],MOD(7-WEEKDAY(Dates[Date],3),7),DAY) 

Power BI give no error, but the new column remains empty. What am I missing? 

1 ACCEPTED SOLUTION
Reimer
Helper II
Helper II

Ive tried this as well. But the formula doesnt keep the monday:

 

Maandag publicatie = 'Procedures - Power BI'[Invoerdatum].[Date] - WEEKDAY('Procedures - Power BI'[Invoerdatum],2)+8

View solution in original post

11 REPLIES 11
PC2790
Community Champion
Community Champion

Doesit work for you:

 

MondayColumn =
var NextMonday= DatesTable[Date].[Date]-MOD(DatesTable[Date]-2,7)
return
if(WEEKDAY(DatesTable[Date],2)=1,DatesTable[Date],NextMonday)

Well this is more then I can handle 🙂

 

Do I just copy this in my Power BI and change

"DatesTable for my column? 

PC2790
Community Champion
Community Champion

Is Invoerdatum your date column?

If yes, then remove the [Date] from everywhere where it is causing the error

Thank you, no more Error. Just two small issues.

 

I am now using this formula:

 

DAX.PNG

 

But this is the output:

 

Dates.PNG

 

So, it return the previous Monday (and should return the next monday), and on Mondays (invoerdatum) it returns a very weird date (and should remain the same)

 

Can you help?

PC2790
Community Champion
Community Champion

Ahh! my bad. 

yes you need to create a calculated column from ColumnTools --> New Column 

and paste this dax iformula there

And yes DatesTable is Dates[Date] for you

error.PNG

 

Something is still wrong? 

amitchandak
Super User
Super User

@Reimer ,

This monday = 'Date'[Date]+-1*WEEKDAY('Date'[Date],2)+1

 

Next monday = 'Date'[Date]+-1*WEEKDAY('Date'[Date],2)+8

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Ive tried this, but is still not quite working. If I use:

 

Next monday = 'Date'[Date]+-1*WEEKDAY('Date'[Date],2)+8

 

Then all days of the week change in the next monday. But also the mondays change in the next monday. But mondays must remain the same.

 

So:

 

Monday 1 januari --> Monday 1 januari

Thuesday 2 januari --> Monday 8 januari

Wednessday 4 januari --> Monday 8 januari

Etc.

@Reimer , Try this if not resolved yet

Next monday = if(WEEKDAY([Date],2)=1, [Date],'Date'[Date]+ 8-1*WEEKDAY('Date'[Date],2) )
Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

WAUW, it is working.

 

Thank you all for your great help and patience! 

Reimer
Helper II
Helper II

Ive tried this as well. But the formula doesnt keep the monday:

 

Maandag publicatie = 'Procedures - Power BI'[Invoerdatum].[Date] - WEEKDAY('Procedures - Power BI'[Invoerdatum],2)+8

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!

December 2024

A Year in Review - December 2024

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