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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! 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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors