Forum Discussion

kkirner's avatar
kkirner
Icon for Helper II rankHelper II
3 years ago
Solved

Trouble Calculating the Date Difference between two fields that are the same, but different values

Good morning!  I'm relatively new to Power BI.  I have a decent understanding of DAX, but have always struggled with the Date/Time calculations. I have a report with multiple tables, but I think wha...
  • johnt75's avatar
    3 years ago

    Try

    Days Diff Title Work to Sign Final Commitment =
    SUMX (
        VALUES ( 'SPSOrder'[Order ID] ),
        VAR TitleWork =
            CALCULATE (
                MAX ( 'SPSTask'[Completed/Received Date] ),
                'SPSTask'[TaskLookupCode] = "TitleWork"
            )
        VAR SignFinalCommitment =
            CALCULATE (
                MAX ( 'SPSTask'[Completed/Received Date] ),
                'SPSTask'[TaskLookupCode] = "SgnFnlCom"
            )
        VAR Result =
            DATEDIFF ( TitleWork, SignFinalCommitment, DAY )
        RETURN
            Result
    )