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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
rjs2
Resolver I
Resolver I

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
rjs2
Resolver I
Resolver I

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
Resolver I
Resolver I

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]))

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors