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
hasharma19
Helper II
Helper II

Dates table Issue (Weekend, Weekdays, holiday)

HI All,

I have two dates table. One is of Holiday list and aother is of request date.

I am looking for solution where the request date match with holiday dates so request date considered  from next weekday.

Similarly if request assigned on weekend so request date next weekday.

Looking for help.

 

hasharma19_0-1685893308303.png

 

Thanks

4 REPLIES 4
Greg_Deckler
Super User
Super User

@hasharma19 Maybe something like:

Column = 
  VAR __DateTime = [Requested Date & Time]
  VAR __Date = DATE( YEAR(__DateTime), MONTH(__DateTime), DAY(__DateTime) )
  VAR __Holidays = SELECTCOLUMNS( 'Holiday List', "Date", [Holiday Date] )
  VAR __Calendar = 
    ADDCOLUMNS(
      EXCEPT(
        CALENDAR( __Date, __Date + 7 ),
        __Holidays
      ),
      "__WeekDay", WEEKDAY([Date], 2)
    )
  VAR __NextWorkDay = MINX( FILTER( __Calendar, [__WeekDay] < 6 ), [Date] )
  VAR __Result = IF( WEEKDAY( __Date, 2 ) > 5 || __Date IN __Holidays, __NextWorkDay, __Date )
RETURN
  __Result

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler Thank you so much Greg!
How can we same implement in power query?

@hasharma19 Umm... @ImkeF 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler @ImkeF 

Hello Both,

Looking forward for solution in power query...Thank you

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.