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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

DAX Balance + Opening issues

Hi,

 

I am trying to calculate a YTD Balance based on a Finance transactions table. The table contains daily balances for all accounts AND a year opening balance for all accounts for all years. The later part is giving me a headache. My working formula so far:

 

BalanceSum(YTD) =
VAR LastDateAllCompanies =
    CALCULATETABLE (
        LASTNONBLANK (
            'CalendarPosting'[Date];
            COUNTROWS ( RELATEDTABLE ( FinanceTransactions ) )
        );
        ALL ( FinanceTransactions[CompanyID] )
    )
VAR Result =
    CALCULATE ( [BalanceSum]; LastDateAllCompanies )
RETURN
    Result
 
To this formula I need to add the opening balances for all accounts for a given year. the Finance transactions table has a true/false column to indicate if its an opening balance.
 
Any suggestions on how to apply this?
1 REPLY 1
Anonymous
Not applicable

I think I am closing in on the solution, but the numbers are still not adding up (but close):

 

BalanceSum(YTD) =
VAR OpeningAllCompanies =
    CALCULATE (
        [BalanceSum];
        FIRSTDATE ( 'Calendar'[Date] );
        FinanceTransactions[Opening] = TRUE
    )
VAR LastDateAllCompanies =
    CALCULATETABLE (
        LASTNONBLANK (
            'Calendar'[Date];
            COUNTROWS ( RELATEDTABLE ( FinanceTransactions ) )
        );
        ALL ( FinanceTransactions[CompanyID] )
    )
VAR Result =
    CALCULATE ( [BalanceSum]; LastDateAllCompanies ) + OpeningAllCompanies
RETURN
    Result
 
I thought this a fairly common scenario in Finance reporting, but is seems to be more complex than I first assumed.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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