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" and "Due Date" as x-axes for several visualizations, and the different dates have been giving me trouble in DAX.

 

*This is a sample data created off of my actual very large data set.

 

 

Thank you so much for your help!!

  • 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] )
            )
        )
    )

2 Replies

  • 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] )
            )
        )
    )
    • Anonymous's avatar
      Anonymous
      Not applicable

      Yes, that worked!! Thank you!!