Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

DAX Help: Multiple Date Ranges impacting formulas.

Hello, I am trying to write a DAX formula which forces the Quantity data field to go to zero after the "Due Date" has been reached, only for "Deal Type" B2. This report uses both the "Order Date" an...
  • jdbuchanan71's avatar
    7 years ago

    Hello Anonymous 

    Give this a try.  This measure assumes you don't already have another measure that just sums quantity.

    Quantity Adjusted =
    CALCULATE (
        SUM ( Table1[Quantity] ),
        KEEPFILTERS (
            FILTER (
                ALL ( Table1[Deal Type], Table1[Order Date], Table1[Due Date] ),
                NOT ( Table1[Deal Type] = "B2"
                    && Table1[Due Date] >= Table1[Order Date] )
            )
        )
    )