Forum Discussion
Add Business Days to Date Column with Duration Column
- Anonymous2 years ago
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]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 __resultBest Regards,
Gao
Community Support TeamIf 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 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)
https://analyticpulse.blogspot.com