Forum Discussion
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!
Hi kbrvy please try this
Past Due Balance =VAR CurrentDate = SELECTEDVALUE('Calendar'[Date])RETURNCALCULATE(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])RETURNCALCULATE(SUM(Orders[Value]),FILTER(Orders,Orders[Due Date] >= CurrentDate &&Orders[Ship Date] > CurrentDate),USERELATIONSHIP(Orders[Ship Date], 'Calendar'[Date]))
6 Replies
- lbendlinSuper 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-Forum/ba-p/963216
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523 - techiesSuper User
Hi kbrvy please try this
Past Due Balance =VAR CurrentDate = SELECTEDVALUE('Calendar'[Date])RETURNCALCULATE(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])RETURNCALCULATE(SUM(Orders[Value]),FILTER(Orders,Orders[Due Date] >= CurrentDate &&Orders[Ship Date] > CurrentDate),USERELATIONSHIP(Orders[Ship Date], 'Calendar'[Date])) - v-karpurapudCommunity 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! - v-karpurapudCommunity 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.- kbrvyRegular Visitor
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.
- v-karpurapudCommunity Support
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.