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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
SupaFlyeSnuka
New Member

New Date if Weekend (Convert Weekend date to Next Business day date)

What is up y'all!?  I'm at a loss here - and frankly not the best at writing queries in PowerBi.  Please help me with this.

 

I have a date column with an "OpenDate"

I created a new column with the Weekday numbers -- WeekDay = WEEKDAY('Sheet1'[OpenDate], 1)

No I know that Saturday is 7 and Sunday is 1

My weekdays are 2 - 6

I also added a column that says if its a workday -- WorkDay = NOT WEEKDAY( 'Sheet1'[OpenDate] ) IN { 1,7 }

 

So, what I want to do is IF the Weekday is 1 or 7, take the OpenDate and add the number of days required to make it a business day, get that new date, and populate it into a new column.

 

For example, say OpenDate was Saturday, February 29, 2020 (= 7).  The next business day would be Monday, March 2, 2020 ( = 2)

I would want to take that Open Date, add 2 days to show the date as Monday, March 2, 2020.

 

Alternatively, if there was a way to assign the business day number within the given month, that would help too.  i.e 1st business day of the month, 2nd business day of the month to 21st business day of the month.

 

Thanks in Advance!

1 ACCEPTED SOLUTION
edhans
Super User
Super User

You can use this formula:

 

Next Work Day =
VAR WorkdayNumber =
    WEEKDAY(
        'Date'[Date],
        2
    )
VAR Result =
    SWITCH(
        TRUE,
        WorkdayNumber < 6, 'Date'[Date],
        WorkdayNumber = 6, 'Date'[Date] + 2,
        WorkdayNumber = 7, 'Date'[Date] + 1
    )
RETURN
    Result

 

It just adds 2 days if a saturday, or 1 if a sunday.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

1 REPLY 1
edhans
Super User
Super User

You can use this formula:

 

Next Work Day =
VAR WorkdayNumber =
    WEEKDAY(
        'Date'[Date],
        2
    )
VAR Result =
    SWITCH(
        TRUE,
        WorkdayNumber < 6, 'Date'[Date],
        WorkdayNumber = 6, 'Date'[Date] + 2,
        WorkdayNumber = 7, 'Date'[Date] + 1
    )
RETURN
    Result

 

It just adds 2 days if a saturday, or 1 if a sunday.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors