Forum Discussion

AlirezaEsmati's avatar
AlirezaEsmati
Regular Visitor
4 years ago
Solved

Help needed for Date difference Dax

Hello everyone, I need help calculating the lead time between two steps of each specific order in front of that step using a calculated column or a measure. Thanks in advance
  • danextian's avatar
    danextian
    4 years ago

    My bad, that should have been:

     

    calc column =
    CALCULATE (
        MAX ( table[Date] ),
        FILTER ( ALL ( table[Step] ), table[Step] = "C" ),
        ALLEXCEPT ( table, table[order] )
    )
        - CALCULATE (
            MAX ( table[Date] ),
            FILTER ( ALL ( table[Step] ), table[Step] = "A" ),
            ALLEXCEPT ( table, table[order] )
        )

    or

    calc column =
    CALCULATE (
        MAX ( table[Date] ),
        table[Step] = "C",
        ALLEXCEPT ( table, table[order] )
    )
        - CALCULATE (
            MAX ( table[Date] ),
            table[Step] = "A",
            ALLEXCEPT ( table, table[order] )
        )