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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. 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
Solution Sage
Solution Sage

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
Solution Sage
Solution Sage

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors