cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
rjs2 Frequent Visitor
Frequent Visitor

Change a date to the following Monday if it falls on a weekend

I am trying to evaluate a date field and change the date to the following Monday if it falls on a weekend.  I tried to use the WEEKDAY and DATEADD in an IF statement.  I keep getting :

 

"A Date Column containing duplicate dates was specified in a call o function 'DATEADD'.  This is not supported."

 

This is my statement:

Date Received = IF(WEEKDAY('Table'[DATE.FIELD],1)=1,Dateadd('Table'[DATE.FIELD],1,DAY))
 
I was going to do an embedend IF statement to calculate the Saturday and Sunday days to be the following monday, else use the date.
 
 
1 ACCEPTED SOLUTION

Accepted Solutions
rjs2 Frequent Visitor
Frequent Visitor

Re: Change a date to the following Monday if it falls on a weekend

solved it:

Created a weekday column then used this in a new column:

Date Received = If('Table'[Weekday]=7,'Table'[DATE]+2, If('Vetting Query'[Weekday]=1,'Table'[DATE]+1,'Table'[DATE]))

View solution in original post

1 REPLY 1
rjs2 Frequent Visitor
Frequent Visitor

Re: Change a date to the following Monday if it falls on a weekend

solved it:

Created a weekday column then used this in a new column:

Date Received = If('Table'[Weekday]=7,'Table'[DATE]+2, If('Vetting Query'[Weekday]=1,'Table'[DATE]+1,'Table'[DATE]))

View solution in original post

Helpful resources

Announcements
October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Badges

Incoming: New and Improved Badges

Exciting news: We've given our badges an overhaul and added brand news ones.

Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 340 members 3,615 guests
Please welcome our newest community members: