Forum Discussion

Greg_Deckler's avatar
Greg_Deckler
Icon for Community Champion rankCommunity Champion
10 years ago

Days Between Dates with Negatives

Have used this one countless times. The problem is that DAYSBETWEEN DAX function does not allow returning negative values, so instead use:

 

DaysBetween = ROUNDUP(1.*[Date]-[OtherDate],0),

3 Replies

  • Phil_Seamark's avatar
    Phil_Seamark
    Icon for Microsoft Employee rankMicrosoft Employee

    Here is an ugly alternative :)

     

    Column = IFERROR(
    DATEDIFF(Dates[Date],Dates[OtherDate],DAY),
    -DATEDIFF(Dates[OtherDate],Dates[Date],DAY )
    )

      • Anonymous's avatar
        Anonymous
        Not applicable
        Just add a column to your Date table that will mark a date as a weekday or weekend day and then filter appropriately in your measures.

        Best
        Darek