Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

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.

 

Sample Date.png

 

Thank you so much for your help!!

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

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

View solution in original post

2 REPLIES 2
jdbuchanan71
Super User
Super User

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
Not applicable

Yes, that worked!! Thank you!!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.