Forum Discussion

Justair07's avatar
Justair07
Resolver I
7 years ago
Solved

DAX for NextWorkingDay

Hi,

 

I found this awesome reference for getting the previous working day to return. Here

 

ThisOrNextWorkingDay = 
	MINX(
		FILTER('tblScrapData','tblScrapData'[Entry Date] > EARLIER('tblScrapData'[Entry Date])
			&& WEEKDAY('tblScrapData'[Entry Date],3) <5), /*0=Monday, 6=Sunday --> hence < 5 is Monday to Friday*/
		'tblScrapData'[Entry Date] 
        )

How can I change this to return the next working day, so if the [Entry Date] is Friday 10/26/2018 then the returned value will be Monday 10/29/2018.

 

Then I can create a field that says if the NextWorkingDay of the [EntryDate] matches Today(), I can only filter on that field. This will allow me to always show data for working days. It's my workaround for showing data for the previous working day.

 

I hope this makes sense.

 

Thank you,

 

- Justin

  • Anonymous's avatar
    Anonymous
    7 years ago

    HI Justair07,

     

    You can try to use below calculate column formula to calculate next working day:

    Next Work Day =
    IF (
        WEEKDAY ( [Date], 3 ) < 4,
        [Date] + 1,
        [Date]
            + ( 7 - WEEKDAY ( [Date], 3 ) )
    )
    

    Regards,

    Xiaoxin Sheng

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    HI Justair07,

     

    You can try to use below calculate column formula to calculate next working day:

    Next Work Day =
    IF (
        WEEKDAY ( [Date], 3 ) < 4,
        [Date] + 1,
        [Date]
            + ( 7 - WEEKDAY ( [Date], 3 ) )
    )
    

    Regards,

    Xiaoxin Sheng