Forum Discussion
Fredde86
1 year agoAdvocate I
Help with NETWORKDAYS counting today as 1, need 0
Hi, I would like my NETWORKDAYS measure to show 0 if the dates are the same, example below. Simply adding "- 1" to my measure in the end does not work since it messes up when I have blank rows th...
- 1 year ago
Hi Fredde86 ,
Please try the bellow DAX measure:
NetWorkdays *History* = SUMX( FILTER( MANUFACTURING_ORDERS_HISTORY, MANUFACTURING_ORDERS_HISTORY[Order nr (HISTORY)] = MAX(ITEM_TRANSACTION_HISTORY_SUM[Order nr]) && MANUFACTURING_ORDERS_HISTORY[Finish_Item_Number] = MAX(ITEM_TRANSACTION_HISTORY_SUM[Item]) ), VAR DueDate = MANUFACTURING_ORDERS_HISTORY[Due Date *History*] VAR CompletionDate = MAX(ITEM_TRANSACTION_HISTORY_SUM[Date]) VAR NetworkDays = NETWORKDAYS( DueDate, CompletionDate ) RETURN -- Adjust result to match expectations IF( DueDate = CompletionDate, 0, IF( DueDate > CompletionDate, NetworkDays - 1, NetworkDays + 1 ) ) )Please, let me know if you're facing any issue.
If this updated measure not works, please provide me a sample data with no sensitive information for your table: MANUFACTURING_ORDERS_HISTORY and ITEM_TRANSACTION_HISTORY_SUM
Bibiano_Geraldo
1 year agoSuper User
Hi Fredde86 ,
Please try the bellow DAX measure:
NetWorkdays *History* =
SUMX(
FILTER(
MANUFACTURING_ORDERS_HISTORY,
MANUFACTURING_ORDERS_HISTORY[Order nr (HISTORY)] = MAX(ITEM_TRANSACTION_HISTORY_SUM[Order nr]) &&
MANUFACTURING_ORDERS_HISTORY[Finish_Item_Number] = MAX(ITEM_TRANSACTION_HISTORY_SUM[Item])
),
VAR DueDate = MANUFACTURING_ORDERS_HISTORY[Due Date *History*]
VAR CompletionDate = MAX(ITEM_TRANSACTION_HISTORY_SUM[Date])
VAR NetworkDays =
NETWORKDAYS(
DueDate,
CompletionDate
)
RETURN
-- Adjust result to match expectations
IF(
DueDate = CompletionDate,
0,
IF(
DueDate > CompletionDate,
NetworkDays - 1,
NetworkDays + 1
)
)
)
Please, let me know if you're facing any issue.
If this updated measure not works, please provide me a sample data with no sensitive information for your table: MANUFACTURING_ORDERS_HISTORY and ITEM_TRANSACTION_HISTORY_SUM
Fredde86
1 year agoAdvocate I
Works like a charm, thank you so much!
- Bibiano_Geraldo1 year agoSuper User
Happy it works Fredde86