Forum Discussion
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?
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
11 Replies
- amitchandakSuper User
Reimer ,
This monday = 'Date'[Date]+-1*WEEKDAY('Date'[Date],2)+1
Next monday = 'Date'[Date]+-1*WEEKDAY('Date'[Date],2)+8
- ReimerHelper II
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.
- amitchandakSuper User
Reimer , Try this if not resolved yet
Next monday = if(WEEKDAY([Date],2)=1, [Date],'Date'[Date]+ 8-1*WEEKDAY('Date'[Date],2) )
- ReimerHelper 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 - PC2790Community Champion
Doesit work for you:
MondayColumn =var NextMonday= DatesTable[Date].[Date]-MOD(DatesTable[Date]-2,7)returnif(WEEKDAY(DatesTable[Date],2)=1,DatesTable[Date],NextMonday)- ReimerHelper II
Well this is more then I can handle 🙂
Do I just copy this in my Power BI and change
"DatesTable for my column?
- PC2790Community 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