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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Edgar_massa
Helper II
Helper II

balance calculation

Good night guys

Here's the thing, I have a bank balance table that brings me the balance on the 1st of each month, and I have a fact table containing my realized balance (income - expense).

I need the print table just below

 

Edgar_massa_0-1693001142495.png

 

to calculate the simple sum of the balance made with the bank balance (- 1,406,019.86) + 7,738,756.96 which gives 6,332,737.10 on day 1, and this result of 6,332,737.10 is calculated on day 2 and so on.

Thanks

1 ACCEPTED SOLUTION
Edgar_massa
Helper II
Helper II

Good afternoon

I managed to solve it as follows

 

    VAR Saldo1 = [Saldo Realizado] + [Saldo de Contas]

    VAR Calc =
    CALCULATE(
        [Saldo Realizado] + [Saldo de Contas],
        FILTER(
            ALLSELECTED(
                dim_Calendario),
                [Saldo Realizado] + Saldo1 ),
               
                dim_Calendario[Data] <= MAX(dim_Calendario[Data])
    )
 
Edgar_massa_0-1693236522216.png

 

 
Very similar to your solution @danextian 
 
Very Thanks
 

View solution in original post

3 REPLIES 3
Edgar_massa
Helper II
Helper II

Good afternoon

I managed to solve it as follows

 

    VAR Saldo1 = [Saldo Realizado] + [Saldo de Contas]

    VAR Calc =
    CALCULATE(
        [Saldo Realizado] + [Saldo de Contas],
        FILTER(
            ALLSELECTED(
                dim_Calendario),
                [Saldo Realizado] + Saldo1 ),
               
                dim_Calendario[Data] <= MAX(dim_Calendario[Data])
    )
 
Edgar_massa_0-1693236522216.png

 

 
Very similar to your solution @danextian 
 
Very Thanks
 
Ashish_Mathur
Super User
Super User

Hi,

Share data in a format that can be pasted in an MS Excel file and show the expected result for a few line items.  Also, if possible, please translate the column names of the Tables in English.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
danextian
Super User
Super User

Hi @Edgar_massa ,

If i undestand your use case right, you're getting the running balance of Saldo Realizado and add it to  Saldo Bancario. Try these measures:

=
CALCULATE (
    [Saldo Realizado],
    FILTER ( ALL ( datestable ), datestable[date] <= MAX ( datestable[date] ) )
) + [Saldo Bancario]

=
CALCULATE (
    [Saldo Realizado],
    FILTER (
        ALLEXCEPT ( datestable, datestable[month] ),
        datestable[date] <= MAX ( datestable[date] )
    )
) + [Saldo Bancario]

=
CALCULATE ( [Saldo Realizado], DATESMTD ( datestable[month] ) ) + [Saldo Bancario]

 

If Saldo Realizado and Saldo Bancario are not measures, replace them with something like SUM( table[Saldo Realizado ] ) and SUM( table[Saldo Bancario] ).





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.