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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
rajasekar_o
Helper V
Helper V

How to calculate closing balance

Hi team 

rajasekar_o_0-1699342101372.png

How to calculate closing balance 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @rajasekar_o ,

I created a sample pbix file(see the attachment), please find the details in it. 

1. Add a index column in Power Query Editor

vyiruanmsft_0-1699509000291.png

2. Create a measure as below to get the closing balance

closing balance = 
VAR _index =
    SELECTEDVALUE ( 'Table'[Index] )
RETURN
    CALCULATE (
        SUM ( 'Table'[credit] ) - SUM ( 'Table'[debit] ),
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Index] <= _index )
    )

vyiruanmsft_1-1699509073994.png

Best Regards

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @rajasekar_o ,

I created a sample pbix file(see the attachment), please find the details in it. 

1. Add a index column in Power Query Editor

vyiruanmsft_0-1699509000291.png

2. Create a measure as below to get the closing balance

closing balance = 
VAR _index =
    SELECTEDVALUE ( 'Table'[Index] )
RETURN
    CALCULATE (
        SUM ( 'Table'[credit] ) - SUM ( 'Table'[debit] ),
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Index] <= _index )
    )

vyiruanmsft_1-1699509073994.png

Best Regards

Ahmedx
Super User
Super User

Share sample pbix file to help you.

I have debit credit data only i want to calculate closing balance 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors