Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
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])
Both tables have inactive Relationship Date[Date] and Orders[ProductionDueDate]
Basicaly, if ProductionDueDate is on Monday and ProdactionDurationInDays takes 4 business days, I would like to start production on Tuesday week before.
Please help
Solved! Go to Solution.
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
I have this working, however I need to have active relationship between Date and Orders tables.
How to change it and activate the relationship in the script using USERELATIONSHIP?
Prod. Start Date (exc. weekends) =
VAR DateIdx =
CALCULATE(
MAX( 'Date'[WorkingDayIndex] ),
'Orders'[ProductionDueDate] = RELATED('Date'[Date] )
)
VAR NewDateIdx = DateIdx - 'Orders'[ProdactionDurationInDays]
RETURN
CALCULATE(
MAX('Date'[Date]),
FILTER(
ALL('Date'),
'Date'[WorkingDayIndex] = NewDateIdx
&& 'Date'[IsWorkingDay] = TRUE()
)
)
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
It's working. Thanks.
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,
Sorry, but this not what I need. I need to calculate weekends etc. Please read the description.
Ok. Will come back
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
145 | |
79 | |
64 | |
52 | |
47 |
User | Count |
---|---|
216 | |
89 | |
76 | |
67 | |
60 |