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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Syndicate_Admin
Administrator
Administrator

Accumulated Balance

Hello

I'm trying to calculate a balance that gives me the summation of an account in a period,

The fields I have are the transid (seat number), the line_id (line number), what I'm looking for is to create a measure that calculates the accumulated balance line by line, that is, what marks the Acum column.

TransIdLine_IDAccountNivel4RefDateDebitCredit Balance Now
7297230000800300001/01/2020 0:001624.310,00 € 1.624,31 1.624,31
984330000800300031/01/2020 0:001624.310,00 € 1.624,31 3.248,62
73131030000800300031/01/2020 0:000,00 €0.45- 0,45 3.248,17
7313430000800300031/01/2020 0:000,00 €1.23- 1,23 3.246,94
7313630000800300031/01/2020 0:000,00 €1.36- 1,36 3.245,58
7313830000800300031/01/2020 0:000,00 €1.81- 1,81 3.243,77
7307030000800300031/01/2020 0:000,00 €1619.46- 1.619,46 1.624,31
5720130000800300014/02/2020 0:00913.320,00 € 913,32 2.537,63
5666130000800300024/02/2020 0:00475.20,00 € 475,20 3.012,83
8505530000800300029/02/2020 0:001309.670,00 € 1.309,67 4.322,50
8493930000800300029/02/2020 0:009.30,00 € 9,30 4.331,80

I've tried this formula but I've got all the same-day notes

Saldo_acum_ = CALCULATE(sum(Consulta1[valor]),FILTER(ALLSELECTED(Consulta1),Consulta1[RefDate]<=MAX(Consulta1[RefDate])))
Os agradecería algo de luz
Greetings.
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Don't @Syndicate_Admin,

Because the date is not unique, you cannot use the Date column for accrual in the FILTER function. You must add an index column in Power Query.

Before you add an index column, you must ensure that the date column is sorted from small to large and that the Balance column is also sorted from small to large, so that the result is as desired.

18.png19.png20.png

Tips: I cannot enter the PBIX file that you provided to add index columns in Power Query, so I exported the data and recreated a PBIX file.

So the measure is

Saldo_acum = CALCULATE(SUM('Sheet1'[Saldo]),FILTER(ALLEXCEPT('Sheet1',Sheet1[Account],Sheet1[BPLId]),[Index]<=MAX('Sheet1'[Index])))

21.png

You can check more details from here.

Best regards

Stephen Tao

If this post helps,then consider Accepting it as the solution to help other members find it faster.

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Don't @Syndicate_Admin,

Because the date is not unique, you cannot use the Date column for accrual in the FILTER function. You must add an index column in Power Query.

Before you add an index column, you must ensure that the date column is sorted from small to large and that the Balance column is also sorted from small to large, so that the result is as desired.

18.png19.png20.png

Tips: I cannot enter the PBIX file that you provided to add index columns in Power Query, so I exported the data and recreated a PBIX file.

So the measure is

Saldo_acum = CALCULATE(SUM('Sheet1'[Saldo]),FILTER(ALLEXCEPT('Sheet1',Sheet1[Account],Sheet1[BPLId]),[Index]<=MAX('Sheet1'[Index])))

21.png

You can check more details from here.

Best regards

Stephen Tao

If this post helps,then consider Accepting it as the solution to help other members find it faster.

Syndicate_Admin
Administrator
Administrator

Hello

Attached the file

Pibx file

The result I have is the red marking, the one I need is the marking in green

JmSahuco_0-1613906642564.png

Thank you

stevedep
Memorable Member
Memorable Member

Hey.

What if there is not only one booking per day per account? Does it consider the order in the table or do I have to insert an index and add that to the formular? If the last is correct, could you please tell me how you would solve it?!

Thank you for responding

It's not exactly what I'm looking for.

I'll explain

I have a calculated column that is the value (debit-credit) - balance

Here's the report

JmSahuco_14-1613762895602.png


As you can see there are several notes that are with the same Refdate '31/01/20', the same TransId 7313 and different Line_Id

The column saldo_acum is the formula I've put up

Saldo_acum_ = CALCULATE(sum(Consulta1[valor]),FILTER(ALLSELECTED(Consulta1),Consulta1[RefDate]<=MAX(Consulta1[RefDate])))

What I want is that instead of joining by date, I make the cumulative line by line by transid and line_id

This result is filtered by Account, so it has to be used for all filters

Thanks a lot

Can you share a sample dataset with some scenarios and expected output?

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

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.