Forum Discussion
Dynamic running Total
- 1 year ago
Thanks for the clarification. To achieve a running total by invoice number that dynamically adjusts based on the aging buckets and always appears as the last column, you can use a DAX measure like this:
Running Total AR = VAR CurrentCustomer = SELECTEDVALUE('AR Table'[Customer Number]) VAR CurrentInvoice = SELECTEDVALUE('AR Table'[Invoice Number]) RETURN CALCULATE( SUM('AR Table'[AR Balance]), FILTER( ALLSELECTED('AR Table'), 'AR Table'[Customer Number] = CurrentCustomer && 'AR Table'[Invoice Number] <= CurrentInvoice ) )
This measure calculates a cumulative total of AR Balance per customer ordered by invoice number and respects your matrix’s current filter context, including dynamic aging buckets.When you add this measure to your matrix, it will automatically appear as the last column after the aging buckets, even if the number of aging buckets varies per customer.
If this post was helpful, please consider marking Accept as solution to assist other members in finding it more easily.
If you continue to face issues, feel free to reach out to us for further assistance!
Hi Zzzzzzz ,
Dynamic running total measure in Power BI that calculates the cumulative AR Balance per Customer, based on Invoice Date or Invoice Number, and takes into account the context of dynamic Aging Buckets.
can you try this measure :
Running Total AR =
VAR CurrentCustomer = SELECTEDVALUE('AR Table'[Customer Number])
VAR CurrentInvoice = SELECTEDVALUE('AR Table'[Invoice Number])
RETURN
CALCULATE(
SUM('AR Table'[AR Balance]),
FILTER(
ALLSELECTED('AR Table'),
'AR Table'[Customer Number] = CurrentCustomer &&
'AR Table'[Invoice Number] <= CurrentInvoice
)
)
Hope this helps !
If this post was helpful, please consider marking Accept as solution to assist other members in finding it more easily.
If you continue to face issues, feel free to reach out to us for further assistance!
hi
its not working its adding a running total after each aging bucket
- v-aatheeque1 year agoCommunity Support
Hi Zzzzzzz ,
To implement a dynamic running total of AR Balances across varying aging buckets and grouped by customer and invoice number/date, we followed a structured approach in Power BI:1.Create a Calendar Table (for time-based calculations)
We used a calendar table to support time intelligence functions like running totals:
Calendar = CALENDARAUTO()
We then established a relationship between:Calendar[Date] and AR Table[Invoice Date]
This relationship enables accurate date-based filtering and aggregation.
2. Create the Running Total Measure (by Invoice Date)
We defined the following DAX measure to compute a running total per customer, ordered by Invoice Date:Running Total AR = VAR CurrentCustomer = SELECTEDVALUE('AR Table'[Customer Number]) VAR MaxDate = MAX('Calendar'[Date]) RETURN CALCULATE( SUM('AR Table'[AR Balance]), FILTER( ALL('Calendar'), 'Calendar'[Date] <= MaxDate ), 'AR Table'[Customer Number] = CurrentCustomer )This measure resets the total per customer and dynamically calculates the cumulative AR balance over time.
3. If invoice numbers are numeric and represent chronological order, you can create an alternative running total that relies on Invoice Number instead of Invoice Date:
Running Total AR by Invoice = VAR CurrentCustomer = SELECTEDVALUE('AR Table'[Customer Number]) VAR CurrentInvoice = SELECTEDVALUE('AR Table'[Invoice Number]) RETURN CALCULATE( SUM('AR Table'[AR Balance]), FILTER( ALL('AR Table'), 'AR Table'[Customer Number] = CurrentCustomer && 'AR Table'[Invoice Number] <= CurrentInvoice ) )Use this when Invoice dates are unreliable.
You want to sort balances specifically by invoice sequence.
If this post was helpful, please consider marking Accept as solution to assist other members in finding it more easily.
If you continue to face issues, feel free to reach out to us for further assistance!
- v-aatheeque1 year agoCommunity Support
Hi Zzzzzzz ,
If the information is helpful, please accept the answer by clicking the "Upvote" and "Accept Answer" on the post. If you are still facing any issue, please let us know in the comments. We are glad to help you.
We value your feedback, and it will help us to assist others who might have a similar query. Thank you for your contribution in enhancing Microsoft Fabric Community Forum.
- v-aatheeque1 year agoCommunity Support
Hi ZZZZZ,
we haven't heard back from you regarding our last response and wanted to check if your issue has been resolved.If the response addressed by the community member for your query, please mark it as Accept Answer and click Yes if you found it helpful.
Thank You.