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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
TimmK
Helper IV
Helper IV

Add 1 Day to Current Date and Skip Weekends and Holidays

Based on the current date I want to add 1 day, but skip weekends and holidays.

 

Examples

  • Current date = April 19, 2023 (WED) + 1 day => April 20, 2023 (THU)
  • Current date = April 19, 2023 (WED) + 1 day; Holiday = April 20, 2023 (THU) => April 21, 2023 (FRI)
  • Current date = April 21, 2023 (FRI) + 1 day; Weekend = April 22, 2023 (SAT) and April 23, 2023 (SUN) => April 24, 2023 (MON)
  • Current date = April 20, 2023 (THU); Holiday = April 21, 2023 (FRI); Weekend = April 22, 2023 (SAT) and April 23, 2023 (SUN) => April 24, 2023 (MON)

 

What measure can I use for this?

 

I have the table Holiday with the columns Date and Holiday. The column Date is the date of the holiday, the column Holiday has value 1 if the date is a holiday.

 

Additionally, I would like to have two variants of the same. Variant 1 = Add 2 days; Variant 2 = Add 3 days

1 ACCEPTED SOLUTION

I adapted it to my table and column naming and added the calculated column, but it did not work. It was loading infinitely. But thanks for the try.

 

The following measure works for me though:

 

Measure 1 =
VAR CurrentDate = TODAY()
RETURN
IF (
    CurrentDate > EOMONTH (CurrentDate, 0),
    BLANK (),
    CALCULATE (
        MIN ('Date'[Date]),
        FILTER (
            'Date',
            'Date'[Date] > CurrentDate
            && 'Date'[IsWeekend] = 0
            && 'Date'[IsHoliday] = 0
        )
    )
)

 

View solution in original post

2 REPLIES 2
FreemanZ
Super User
Super User

hi @TimmK 

Supposing 20th and 21st are holiday, try to add a calculated column like:

Column = 
MINX(
    FILTER(
        Dates,
        Dates[IsHoliday]=0
            &&NOT WEEKDAY([Date],2) IN {6,7} 
            &&Dates[Date]>EARLIER(Dates[Date])
    ),
    Dates[Date]
)

 

it worked like:

FreemanZ_1-1681907377922.png

I adapted it to my table and column naming and added the calculated column, but it did not work. It was loading infinitely. But thanks for the try.

 

The following measure works for me though:

 

Measure 1 =
VAR CurrentDate = TODAY()
RETURN
IF (
    CurrentDate > EOMONTH (CurrentDate, 0),
    BLANK (),
    CALCULATE (
        MIN ('Date'[Date]),
        FILTER (
            'Date',
            'Date'[Date] > CurrentDate
            && 'Date'[IsWeekend] = 0
            && 'Date'[IsHoliday] = 0
        )
    )
)

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors