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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Opening balance calculation

Hi,

 

I am trying to calculate opening balance for each month from my available data. I have also added a slicer for month to see the opening balance for selected month. I have used following formula (Referred from a solution in community messages - https://community.powerbi.com/t5/Desktop/DAX-Closing-and-Opening-Balances/m-p/232590#M103612😞

 

Opening Balance =
CALCULATE(
    SUM(table1[Balance]),
    FILTER(
        ALL(table1),
        SUMX(
            FILTER( table1,
                EARLIER(table1[Date]) = LASTDATE(PREVIOUSMONTH(table1[Date]))),
         (table1[Balance])
         ))

 

Everything is working fine except that if i crossfilter (based on interactions), opening balance remains constant. Only slicer seems to be working fine. I am assuming that this is because of ALL function in the formula. However if i remove ALL, the column goes blank for opening balance. 

 

Can someone help me with the situation.

 

 

Thanks in Advance

2 REPLIES 2
v-danhe-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

Could you have tried with a measure instead of a calculated column? Or you could use the OPENINGBALANCEMONTH function to have a try. If the problem still persists, could you please offer a sample file to have a test and post your desired result if possible?

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

https://drive.google.com/open?id=1i3MMEhFoJEGX6KMouRk9nMgNJWaFGwyX

 

Hi @v-danhe-msft,

 

Attached is the link to the test file. I need my opening balances to be divided betweent the sources, however i get the total across all data sources. How to make that change?

 

Thanks

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.