Forum Discussion

Fredde86's avatar
Fredde86
Advocate I
1 year ago
Solved

NETWORKDAYS between two tables containing duplicate OrderIDs

I have a DATEDIFF calculated column that gives me the datediff between two tables and it has two flaws that I would like to solve with a NETWORKDAYS solution, if possible..   Diff Days *History* =...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi, Fredde86 
    Based on your information, I created sample tables:

    Then create a new measure, try the following DAX expression:

    Diff Days *History* = 
        SUMX (
            FILTER (
                MANUFACTURING_ORDERS_HISTORY,
                MANUFACTURING_ORDERS_HISTORY[OrderID] = MAX(ITEM_TRANSACTION_HISTORY_SUM[OrderID]) &&
                MANUFACTURING_ORDERS_HISTORY[Item Nr] = MAX(ITEM_TRANSACTION_HISTORY_SUM[Item Nr])
            ),
            NETWORKDAYS (
                MANUFACTURING_ORDERS_HISTORY[Due Date History],
                MAX(ITEM_TRANSACTION_HISTORY_SUM[Date])
            )
        )

    Put it in table visual, here is my preview:

     

    How to Get Your Question Answered Quickly

    Best Regards

    Yongkang Hua

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.