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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Jos1986
Frequent Visitor

Last Business Day that incorporates Holidays

Hello. We currently use the below formula to calculate last day sales. As you can see it takes into account weekends and skips those days. However, we want to also exclude our company holidays which are known dates. Is there any way I can bring that into this DAX at all or do I have to start with an entirely new measure?
 
Last Day Sales (USD) =
VAR _Today =
    TODAY ()
VAR _latestDate = _Today - 1
VAR _DD =
    SWITCH (
        WEEKDAY ( _Today ),
        2, _Today - 3,
        1, _Today - 2,
        7, _Today - 1,
        _latestDate
    )
RETURN
    CALCULATE ('Sales'[All Sales (USD)], 'Date'[Date] = _DD)
1 ACCEPTED SOLUTION
vicky_
Super User
Super User

If you have known holidays, put those in a table and use the NETWORKDAYS function. so something like

Last Day Sales (USD) = CALCULATE(MAX('date'[Date]), NETWORKDAYS('date'[Date],  TODAY(), 1 , holiday) = 2), 
where holiday is the name of the table containing your company holidays.

View solution in original post

1 REPLY 1
vicky_
Super User
Super User

If you have known holidays, put those in a table and use the NETWORKDAYS function. so something like

Last Day Sales (USD) = CALCULATE(MAX('date'[Date]), NETWORKDAYS('date'[Date],  TODAY(), 1 , holiday) = 2), 
where holiday is the name of the table containing your company holidays.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.