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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric 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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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