Forum Discussion
Adamplau
4 years agoNew Member
Calculate when start production (excluding weekends)
Hi Guys, I would like to callculate when I should start production, excluding weekends. I have two tables Date (mater calendar) and Orders (with [ProductionDueDate] and [ProdactionDurationInDays]) ...
- Anonymous3 years ago
Hi Adamplau ,
You can update the formula of the calculated column [Prod. Start Date (exc. weekends)] as below in the table 'Orders' and check if it can return your expected result... It is not required to create any relationship between the table 'Orders' and 'Date' table.
Prod. Start Date (exc. weekends) = VAR DateIdx = CALCULATE ( MAX ( 'Date'[WorkingDayIndex] ), FILTER ( 'Date', 'Date'[Date] = 'Orders'[ProductionDueDate] ) ) VAR NewDateIdx = DateIdx - 'Orders'[ProdactionDurationInDays] RETURN CALCULATE ( MAX ( 'Date'[Date] ), FILTER ( ALL ( 'Date' ), 'Date'[WorkingDayIndex] = NewDateIdx && 'Date'[IsWorkingDay] = TRUE() ) )Best Regards
Arul
Super User
4 years agoAdamplau ,
I hope the below query would help you to solve the problem,
Starting Day =
VAR _date =
SELECTEDVALUE ( 'Table'[ProductionDueDate] )
VAR _duration =
SELECTEDVALUE ( 'Table'[ProdactionDurationInDays] )
RETURN
"Start Production on [" & FORMAT ( _date - _duration, "dddd-mmm-d" )&"]"
Thanks,