Forum Discussion
Leadtime evaluation impossible with this scenario?
- 1 year ago
Fredde86 Try using
DAX
NetWorkdays_v2 =
VAR SelectedOrder = MAX(ITEM_TRANSACTION_HISTORY_SUM[Order nr])
VAR SelectedItem = MAX(ITEM_TRANSACTION_HISTORY_SUM[Item])VAR FilteredOrders =
FILTER(
MANUFACTURING_ORDERS,
MANUFACTURING_ORDERS[Order nr] = SelectedOrder &&
MANUFACTURING_ORDERS[Item] = SelectedItem
)VAR DueDate = MAXX(FilteredOrders, MANUFACTURING_ORDERS[Order Due])
VAR CompletionDates =
FILTER(
ITEM_TRANSACTION_HISTORY_SUM,
ITEM_TRANSACTION_HISTORY_SUM[Order nr] = SelectedOrder &&
ITEM_TRANSACTION_HISTORY_SUM[Item] = SelectedItem
)VAR LeadTimes =
ADDCOLUMNS(
CompletionDates,
"LeadTime",
VAR CompletionDate = ITEM_TRANSACTION_HISTORY_SUM[Date reported]
VAR CurrentDueDate =
CALCULATE(
MAX(MANUFACTURING_ORDERS[Order Due]),
FILTER(
MANUFACTURING_ORDERS,
MANUFACTURING_ORDERS[Order nr] = SelectedOrder &&
MANUFACTURING_ORDERS[Item] = SelectedItem &&
MANUFACTURING_ORDERS[Order Due] <= CompletionDate
)
)
VAR Workdays =
IF(
ISBLANK(CurrentDueDate) || ISBLANK(CompletionDate),
BLANK(),
CALCULATE(
COUNTROWS('Date'),
'Date'[Date] >= MIN(CurrentDueDate, CompletionDate) && 'Date'[Date] <= MAX(CurrentDueDate, CompletionDate),
'Date'[ArbetsDag] = 1,
ISBLANK('Date'[Helgdagar]),
NOT(WEEKDAY('Date'[Date],2) = 5 && QUARTER('Date'[Date]) = 1 && WEEKNUM('Date'[Date], 2) >= 4 && WEEKNUM('Date'[Date], 2) <= 13)
)
)
RETURN
IF(
ISBLANK(Workdays),
BLANK(),
IF(
CurrentDueDate = CompletionDate,
0,
IF(
CurrentDueDate > CompletionDate,
- (Workdays - 1),
Workdays - 1
)
)
)
)VAR TotalLeadTime = SUMX(LeadTimes, [LeadTime])
RETURN
TotalLeadTime
Hi Fredde86,
As we haven’t heard back from you, so just following up to our previous message. I'd like to confirm if you've successfully resolved this issue or if you need further help.
If yes, you are welcome to share your workaround and mark it as a solution so that other users can benefit as well. If you find a reply particularly helpful to you, you can also mark it as a solution.
If you still have any questions or need more support, please feel free to let us know. We are more than happy to continue to help you.
Thank you for your patience and look forward to hearing from you.
Hi Fredde86,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution so that other community members can find it easily.
Thank you.
- Anonymous1 year agoNot applicable
Hi Fredde86,
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.