Forum Discussion

Anett_R's avatar
Anett_R
Frequent Visitor
2 years ago
Solved

Subtract working days from date column

Hello everybody,   I have the following issue:  I have a date from which I have to subtract the shipping time (in working days) to determine the planned shipping day.     In this example,...
  • AlienSx's avatar
    2 years ago

    Anett_R this function should solve your problem in PQ

        wd = (delivery_date, days) => 
            if days = 0 
                then delivery_date 
                else @wd(
                    Date.AddDays(delivery_date, -1), 
                    if List.Contains({0, 6}, Date.DayOfWeek(delivery_date, Day.Monday)) 
                    then days 
                    else days - 1
                )