Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
11 months ago
Solved

ENDING BALANCE AS BEGINNING BALANCE NEXT DAY

 

Help me create the DAX.
I want to display the ending balance on Sep 22, 2025 as the beginning balance on the next day.
Beginning balance on Sep 23, should be 9,979,154,330.51.
Ending balance is calculated as 
Beginning Balance + Total Receipt - Total Payments

  • Hi Anonymous , you want:

    • Beginning Balance of each date = Ending Balance of the previous date
    • Ending Balance = Beginning Balance + Total Receipt – Total Payment

     

    Step 1 — Calculate Ending Balance

    You can use this calculated column (if you already have the Beginning Balance):

     

    Ending Balance =

    [Beginning Balance] + [Total Receipt] - [Total Payment]

     

    Step 2 — Calculate Beginning Balance dynamically

    If you want to compute the Beginning Balance automatically from the previous day's Ending Balance, use this DAX:

     

    Beginning Balance =

    VAR CurrentDate = [Date]

    VAR PrevDate =

        CALCULATE(

            MAX('Table'[Date]),

            FILTER('Table', 'Table'[Date] < CurrentDate)

        )

    VAR PrevEnding =

        CALCULATE(

            MAX('Table'[Ending Balance]),

            FILTER('Table', 'Table'[Date] = PrevDate)

        )

    RETURN

    IF(

        ISBLANK(PrevEnding),

        [Beginning Balance],   // Keep first day's balance as starting point

        PrevEnding

    )

     

    Step 3 — Optional: Recalculate Ending Balance consistently

    To make it fully dynamic (so you don’t need to manually set Beginning Balance each day), use this:

     

    Ending Balance =

    VAR CurrentDate = [Date]

    VAR PrevDate =

        CALCULATE(

            MAX('Table'[Date]),

            FILTER('Table', 'Table'[Date] < CurrentDate)

        )

    VAR PrevEnding =

        CALCULATE(

            MAX('Table'[Ending Balance]),

            FILTER('Table', 'Table'[Date] = PrevDate)

        )

    VAR Beginning =

        IF(

            ISBLANK(PrevEnding),

            [Beginning Balance],

            PrevEnding

        )

    RETURN

    Beginning + [Total Receipt] - [Total Payment]

     

    Important Notes:

    1. Replace 'Table' with your actual table name.
    2. Make sure [Date] is a Date data type (not text).
    3. Sort your visuals by Date ascending.

     

    If this post helped resolve your issue, please mark it as the accepted solution to make it easier for others to find.

     

    Regards,

    Khashayar Yazdani | Microsoft MCT

    https://www.linkedin.com/in/khashayary/

     

7 Replies

  • Create these measures:

    Beginning Balance =
    VAR PreviousDate = MAX('Date'[Date]) - 1
    RETURN
    CALCULATE(
    [Ending Balance],
    DATEADD('Date'[Date], -1, DAY)
    )

     

    Ending Balance = [Beginning Balance] + [Total Receipt] - [Total Payments]

     

    The Beginning Balance measure automatically pulls the previous day's ending balance.

     

  • Anonymous , Try using

     

    Beginning Balance =
    VAR PrevDate =
    CALCULATE(
    MAX('Table'[Date]),
    FILTER(
    'Table',
    'Table'[Date] < EARLIER('Table'[Date])
    )
    )
    RETURN
    IF(
    ISBLANK(PrevDate),
    'Table'[Beginning Balance], // For the first row, keep the original value
    CALCULATE(
    MAX('Table'[Ending Balance]),
    FILTER('Table', 'Table'[Date] = PrevDate)
    )
    )

    • Anonymous's avatar
      Anonymous
      Not applicable

      Not working. Sep 23 beginning balance is still using the beginning balance of Sep 22, 10,079,297,420.51.

      It should be using 9,979,154,330.51 + 12,084,102 -  21410927 = 9,969,827,505.51. I'm getting wrong value in ending balance of Sep 23.

       

       

      • bhanu_gautam's avatar
        bhanu_gautam
        Icon for Super User rankSuper User

        Anonymous , Try using

         

        dax
        Beginning Balance Dynamic =
        VAR PrevDate =
        CALCULATE(
        MAX('Table'[Date]),
        FILTER(
        'Table',
        'Table'[Date] < EARLIER('Table'[Date])
        )
        )
        RETURN
        IF(
        ISBLANK(PrevDate),
        'Table'[Beginning Balance], // For the first row, keep the original value
        CALCULATE(
        MAX('Table'[Ending Balance]),
        FILTER('Table', 'Table'[Date] = PrevDate)
        )
        )

         

        Create a calculated column for Ending Balance as:

        dax
        Ending Balance Dynamic =
        [Beginning Balance Dynamic] + [Total Receipt] - [Total Payment]

  • Hi Anonymous , you want:

    • Beginning Balance of each date = Ending Balance of the previous date
    • Ending Balance = Beginning Balance + Total Receipt – Total Payment

     

    Step 1 — Calculate Ending Balance

    You can use this calculated column (if you already have the Beginning Balance):

     

    Ending Balance =

    [Beginning Balance] + [Total Receipt] - [Total Payment]

     

    Step 2 — Calculate Beginning Balance dynamically

    If you want to compute the Beginning Balance automatically from the previous day's Ending Balance, use this DAX:

     

    Beginning Balance =

    VAR CurrentDate = [Date]

    VAR PrevDate =

        CALCULATE(

            MAX('Table'[Date]),

            FILTER('Table', 'Table'[Date] < CurrentDate)

        )

    VAR PrevEnding =

        CALCULATE(

            MAX('Table'[Ending Balance]),

            FILTER('Table', 'Table'[Date] = PrevDate)

        )

    RETURN

    IF(

        ISBLANK(PrevEnding),

        [Beginning Balance],   // Keep first day's balance as starting point

        PrevEnding

    )

     

    Step 3 — Optional: Recalculate Ending Balance consistently

    To make it fully dynamic (so you don’t need to manually set Beginning Balance each day), use this:

     

    Ending Balance =

    VAR CurrentDate = [Date]

    VAR PrevDate =

        CALCULATE(

            MAX('Table'[Date]),

            FILTER('Table', 'Table'[Date] < CurrentDate)

        )

    VAR PrevEnding =

        CALCULATE(

            MAX('Table'[Ending Balance]),

            FILTER('Table', 'Table'[Date] = PrevDate)

        )

    VAR Beginning =

        IF(

            ISBLANK(PrevEnding),

            [Beginning Balance],

            PrevEnding

        )

    RETURN

    Beginning + [Total Receipt] - [Total Payment]

     

    Important Notes:

    1. Replace 'Table' with your actual table name.
    2. Make sure [Date] is a Date data type (not text).
    3. Sort your visuals by Date ascending.

     

    If this post helped resolve your issue, please mark it as the accepted solution to make it easier for others to find.

     

    Regards,

    Khashayar Yazdani | Microsoft MCT

    https://www.linkedin.com/in/khashayary/

     

  • v-karpurapud's avatar
    v-karpurapud
    Icon for Community Support rankCommunity Support

    Hi Anonymous 

    Thanks for reaching out to the Microsoft fabric community forum. 

     

    I would also take a moment to thank  bhanu_gautam , Kedar_Pande  and Khashayar  for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference.

    I hope the below details help you fix the issue. If you still have any questions or need more help, feel free to reach out. We’re always here to support you 

       

    Best Regards, 
    Community Support Team  

  • v-karpurapud's avatar
    v-karpurapud
    Icon for Community Support rankCommunity Support

    Hi Anonymous 

    We have not received a response from you regarding the query and were following up to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions.

     

    Thank You.