Forum Discussion

Zzzzzzz's avatar
Zzzzzzz
Frequent Visitor
1 year ago
Solved

Dynamic running Total

Hi everyone, I'm looking for help with a DAX formula in Power BI. I want to create a dynamic running total that calculates aging by amount of days. My matrix table is set up with: - Customer Number,...
  • v-aatheeque's avatar
    v-aatheeque
    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!