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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
mweyri01
New Member

Add Business Days to Date Column with Duration Column

Hi there,

 

I have a column named "Start Date" formatted as a date and a column named "Duration" formatted as a whole number. I am looking to create a column named "End Date" which adds the adds the number of business days (Monday-Friday) from the "Duration" column to the "Start Date" column. 

 

Any help would be greatly appreciated! 

 

For example:

Start Date Duration DESIRED OUTPUT
Monday, April 15, 2024 4 Friday, April 19, 2024
Wednesday, May 1, 2024 6 Thursday, May 9, 2024
Wednesday, June 5, 2024 10 Wednesday, June 19, 2024
Sunday, March 17, 2024 3 Wednesday, March 20, 2024
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @mweyri01 ,

Here's my solution.
1. add 2 calculated column in 'date' table:

Working Day = IF ( NOT WEEKDAY ( 'Date'[Date], 2 ) IN { 6, 7 }, TRUE(), FALSE() )
Working Day Number = 
RANKX (
    FILTER (
        'Date',
        'Date'[Working Day]
    ),
    'Date'[Date],
    ,
    ASC
) - NOT 'Date'[Working Day]

vcgaomsft_0-1716260123920.png

add a calculated column in 'table':

End Date = 
VAR __rank = RELATED('Date'[Working Day Number])
VAR __working_day_number = __rank + 'Table'[Duration]
VAR __result = CALCULATE(MIN('Date'[Date]),FILTER(ALL('Date'),'Date'[Working Day Number] = __working_day_number && 'Date'[Working Day]))
RETURN
__result

vcgaomsft_1-1716260208002.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

View solution in original post

4 REPLIES 4
Syndicate_Admin
Administrator
Administrator

You can solve it in Power BI using Power Query and a custom function that adds only business days. A handy option is to use List.Dates to generate dates from the "Start Date", filter only the working days (Monday to Friday using Date.DayOfWeek), and then take the corresponding date based on the duration. Here's the focus:

Open Power Query.

Add a custom column with this code:


startDate = [Fecha de inicio],
duration = [Duración],
datesList = List.Dates(startDate, duration * 2, #duration(1,0,0,0)),
workdays = List.Select(datesList, each Date.DayOfWeek(_, Day.Monday) <= 4),
endDate = workdays{duration - 1}
in
endDate

Anonymous
Not applicable

Hi @mweyri01 ,

Here's my solution.
1. add 2 calculated column in 'date' table:

Working Day = IF ( NOT WEEKDAY ( 'Date'[Date], 2 ) IN { 6, 7 }, TRUE(), FALSE() )
Working Day Number = 
RANKX (
    FILTER (
        'Date',
        'Date'[Working Day]
    ),
    'Date'[Date],
    ,
    ASC
) - NOT 'Date'[Working Day]

vcgaomsft_0-1716260123920.png

add a calculated column in 'table':

End Date = 
VAR __rank = RELATED('Date'[Working Day Number])
VAR __working_day_number = __rank + 'Table'[Duration]
VAR __result = CALCULATE(MIN('Date'[Date]),FILTER(ALL('Date'),'Date'[Working Day Number] = __working_day_number && 'Date'[Working Day]))
RETURN
__result

vcgaomsft_1-1716260208002.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

Hi @Anonymous 

 

Thank you for your help! This worked for me. 

AnalyticPulse
Super User
Super User

hi @mweyri01 
i have assumed your table name as Current_table 
try below dax:

End Date =
VAR _startDate = Current_table[Start Date]
VAR _duration = Current_table[Duration]

VAR _endDate =
_startDate +
INT((_startDate + _duration + 5) / 7) * 2 +
MOD((_startDate + _duration), 7) - MOD(_startDate, 7)

RETURN
_endDate + IF(MOD(_endDate, 7) > 4, 2, 0)

 

Learn Power BI free:

https://analyticpulse.blogspot.com

Power BI : getting started

Dax functions

powerbi Visualisation

AnalyticPulse_0-1715829624787.png

 

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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