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
OLADAODU
Frequent Visitor

Calculate accurate Datediff to determine future dates based on timescales

Hi guys,

 

Please i need to quickly pick on someone brain for help. 

 

I want to determine a future dates based on an agreed timescales in days only workdays( excluding weekend and bank holiday). 

My result is counting weekends but i need to detrimine the dates by adding only the workdays (in this context delivery timescale).

 

any help wih be great 

 

Order DateDelivery timescale (days)statusFuture delivery date (based on workdays and exclude bank holidays) ?
21/08/202030Large item 
16/07/202014small items 
11/09/202060customised item  

 

4 REPLIES 4
Greg_Deckler
Super User
Super User

@OLADAODU Sounds like you want kind of the reverse of Net Work Days: https://community.powerbi.com/t5/Quick-Measures-Gallery/Net-Work-Days/m-p/367362#M109

 

Do you have a date table with workday/not workday already flagged or no?


@ 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 

 

Thanks I do have a calendar table with workdays already calculated.

I have used that to claculated the workdays from the order date to current date but cant get around to determine the future date based on the timescales 

 

 

 

@OLADAODU OK, so then you should be able to do this:

Column =
  VAR __OrderDate = [Order Date]
  VAR __DeliveryDays = [Delivery timescale (days)]
  VAR __Table = FILTER('Calendar',[Date]>=__OrderDate && [Date]<=__OrderDate + __DeliveryDays * 2)
  VAR __Table1 = FILTER(__Table,[Worday] = 1)
  VAR __Table2 =
    ADDCOLUMNS(
      __Table1,
      "Rank",COUNTROWS(FILTER(__Table1,[Date]<=EARLIER([Date])))
    )
RETURN
  MAXX(FILTER(__Table2,[Rank]=__DeliveryDays),[Date])

Something along those lines.


@ 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 

 

Thanks for your reply. i have been away. 

Unfortunately I still cant determine what the date will be using this variable as the result is coming back as blank

 

I dont understand the rank you used and why the deliverydays variable multiple by 2.

 

I just need to know the exact date from today() if dilivery is due in 30 days excluding weekend and public holidays. considering my  calendar_Table[Working days] =1

 

For example: Today() + 30 days = 3/11/2020

22/09/2020 + 30days = 3/11/2020 - this should be my result

 

rather than getting 22/10/2020

 

tips will be helpful

 

Thanks

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.