Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

DateDiff showing wrong value

Hello -   Using the calculated column below, my datediff number if not giving me the correct values.       The order below shipped on June 17.   The lead for that eventually generated an order was ...
  • mahoneypat's avatar
    6 years ago

    Not knowing what the relationship is between your two tables, you could try this expression

     

    Date Diff =
    VAR __orderdate =
        MIN ( SalesLifecycle[LeadCreateDate] )
    VAR __thisorder =
        MIN ( SalesLifecycle[Order] )
    VAR __shippeddate =
        CALCULATE (
            MIN ( Shipments[Date Shipped] ),
            ALLSELECTED ( Shipments ),
            Shipments[Order] = __thisorder
        )
    RETURN
        DATEDIFF ( __orderdate, __shippeddate, DAY )

     

    If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

    Regards,

    Pat