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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
kbrvy
Regular Visitor

Rolling Sum Until Certain Date

I am trying to sum past due and not past due order balances. I have order line items with a value, due date, and ship date. I want to sum the value up until the due date to use in a visual as "Not Past Due" and then once the order passes its due date have it sum for months after that as "Past Due" until it reaches the ship date at which point it will not be included in the sum anymore at all. Is this do-able? I am struggling very much to make this work. Thanks in advance for any help!

1 ACCEPTED SOLUTION
techies
Super User
Super User

Hi @kbrvy please try this

Past Due Balance =
VAR CurrentDate = SELECTEDVALUE('Calendar'[Date])
RETURN
CALCULATE(
    SUM(Orders[Value]),
    FILTER(
        ALL(Orders),  
        Orders[Due Date] < CurrentDate &&
        Orders[Ship Date] > CurrentDate
    ),
    USERELATIONSHIP(Orders[Ship Date], 'Calendar'[Date])
)
 
Not Past Due Balance =
VAR CurrentDate = SELECTEDVALUE('Calendar'[Date])
RETURN
CALCULATE(
    SUM(Orders[Value]),
    FILTER(
        Orders,
        Orders[Due Date] >= CurrentDate &&
        Orders[Ship Date] > CurrentDate
    ),
    USERELATIONSHIP(Orders[Ship Date], 'Calendar'[Date])
)
― Power BI | Microsoft Fabric | PL-300 | DP-600 | Blog: medium.com/@cseprs_54978

View solution in original post

6 REPLIES 6
v-karpurapud
Community Support
Community Support

Hi @kbrvy 

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.

Thank you.

HI, I have now had the chance to try with this query again and was not able to make the proposed solution work for my situation, but have found another solution that will. I appreciate the help. Thanks.

Hi @kbrvy 

We are pleased to hear that you have found a solution. Kindly let us know if it successfully resolved your issue. If it did, please share the details here and mark it as 'Accept as solution' to assist others with similar problems. If it did not, please provide further details.

Thank you.

v-karpurapud
Community Support
Community Support

Hi @kbrvy 

Could you please confirm if your query have been resolved the solution provided by @techies ? If they have, kindly mark the helpful response and accept it as the solution. This will assist other community members in resolving similar issues more efficiently. If it is not  resolved, please share the sample data and provide us the detailed information regarding expected output. It will help us to assist you better.

Thank You!

 

techies
Super User
Super User

Hi @kbrvy please try this

Past Due Balance =
VAR CurrentDate = SELECTEDVALUE('Calendar'[Date])
RETURN
CALCULATE(
    SUM(Orders[Value]),
    FILTER(
        ALL(Orders),  
        Orders[Due Date] < CurrentDate &&
        Orders[Ship Date] > CurrentDate
    ),
    USERELATIONSHIP(Orders[Ship Date], 'Calendar'[Date])
)
 
Not Past Due Balance =
VAR CurrentDate = SELECTEDVALUE('Calendar'[Date])
RETURN
CALCULATE(
    SUM(Orders[Value]),
    FILTER(
        Orders,
        Orders[Due Date] >= CurrentDate &&
        Orders[Ship Date] > CurrentDate
    ),
    USERELATIONSHIP(Orders[Ship Date], 'Calendar'[Date])
)
― Power BI | Microsoft Fabric | PL-300 | DP-600 | Blog: medium.com/@cseprs_54978
lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.

Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

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.