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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
dcormiernj
Helper I
Helper I

Balance Sheet Running Balance sheet type/Account/Year/period

I have searched and cant find something that works for me.  I have a table im calling balance sheet data and it is structured kind of like the paste below.  I am trying to calculate the ending balance for each balancesheettype/Account/Fiscalyear/fiscalperiod

The pseudo code would be the following:

1.  If Fiscal period = 1 then ending balance = beginning balance + Net change

2.  If fiscal period is > 1 then ending balance = ending balance from previous + netchange

Not sure if this is enough information to make my question clear.  But I am struggling with how to get this done in Mcode.

Thanks for your help

Then when i have the ending balances for all the individuals, I will want to do visuals that can pull it for the month, QTR and year.

 

 

Balance Sheet TypeAccount NbrFiscal YearFiscal PeriodBeginning BalanceNetChangeEnding Balance
Assets1234-00-00020211$1,000.00$52.00 
Assets1234-00-00020212 -$96.00 
Assets1234-00-00020213 $500.00 
Assets1234-00-00020214 $750.00 
Assets1234-00-00020215 $350.00 
Assets1234-00-00020216 -$698.00 
Assets1234-00-00020217 $789.00 
Assets1234-00-00020218   
Assets1234-00-00020219   
Assets1234-00-000202110   
Assets1234-00-000202111   
Assets1234-00-000202112   
Assets5678-00-00020211$555.00$58.00 
Assets5678-00-00020212 $1,616.00 
Assets5678-00-00020213 -$99.00 
Assets5678-00-00020214 $458.00 
Assets5678-00-00020215 $222.00 
Assets5678-00-00020216 $111.00 
Assets5678-00-00020217 $7,979.00 
Assets5678-00-00020218   
Assets5678-00-00020219   
Assets5678-00-000202110   
Assets5678-00-000202111   
Assets5678-00-000202112   
Assets3456-00-00020211$987.00$111.00 
Assets3456-00-00020212 $222.00 
Assets3456-00-00020213 $333.00 
Assets3456-00-00020214 $444.00 
Assets3456-00-00020215 $555.00 
Assets3456-00-00020216 $666.00 
Assets3456-00-00020217 $777.00 
Assets3456-00-00020218   
Assets3456-00-00020219   
Assets3456-00-000202110   
Assets3456-00-000202111   
Assets3456-00-000202112   
2 ACCEPTED SOLUTIONS
DataInsights
Super User
Super User

@dcormiernj,

 

Here's a DAX solution. Calculated column:

 

Ending Balance = 
VAR vAccount = Table1[Account Nbr]
VAR vYear = Table1[Fiscal Year]
VAR vPeriod = Table1[Fiscal Period]
VAR vBegBal =
    CALCULATE (
        SUM ( Table1[Beginning Balance] ),
        ALLEXCEPT ( Table1, Table1[Account Nbr], Table1[Fiscal Year] ),
        Table1[Fiscal Period] = 1
    )
VAR vTable =
    FILTER (
        Table1,
        Table1[Account Nbr] = vAccount
            && Table1[Fiscal Year] = vYear
            && Table1[Fiscal Period] <= vPeriod
    )
VAR vResult =
    vBegBal + SUMX ( vTable, Table1[NetChange] )
RETURN
    vResult

 

DataInsights_0-1628170380333.png

 





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

Proud to be a Super User!




View solution in original post

@dcormiernj,

 

When using the DATESYTD function (or any time intelligence function), be sure to use a date table that has a relationship with the fact table. You can create a date column in the fact table and create a relationship using the date column. Here's the measure in case anyone is interested:

 

Ending Balance = 
CALCULATE (
    SUM ( Table1[Beginning Balance] ) + SUM ( Table1[Net Change] ),
    DATESYTD ( DimDate[Date] )
)

 

In the visual, Fiscal Year and Fiscal Period should be from the date table.

 

DataInsights_0-1628866205129.png

 





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

Proud to be a Super User!




View solution in original post

3 REPLIES 3
dcormiernj
Helper I
Helper I

Thank you for your response.  This is great.  However, I had also found and used the DAYSYTD time intelligence function and that worked very easily.  thank you

 

@dcormiernj,

 

When using the DATESYTD function (or any time intelligence function), be sure to use a date table that has a relationship with the fact table. You can create a date column in the fact table and create a relationship using the date column. Here's the measure in case anyone is interested:

 

Ending Balance = 
CALCULATE (
    SUM ( Table1[Beginning Balance] ) + SUM ( Table1[Net Change] ),
    DATESYTD ( DimDate[Date] )
)

 

In the visual, Fiscal Year and Fiscal Period should be from the date table.

 

DataInsights_0-1628866205129.png

 





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

Proud to be a Super User!




DataInsights
Super User
Super User

@dcormiernj,

 

Here's a DAX solution. Calculated column:

 

Ending Balance = 
VAR vAccount = Table1[Account Nbr]
VAR vYear = Table1[Fiscal Year]
VAR vPeriod = Table1[Fiscal Period]
VAR vBegBal =
    CALCULATE (
        SUM ( Table1[Beginning Balance] ),
        ALLEXCEPT ( Table1, Table1[Account Nbr], Table1[Fiscal Year] ),
        Table1[Fiscal Period] = 1
    )
VAR vTable =
    FILTER (
        Table1,
        Table1[Account Nbr] = vAccount
            && Table1[Fiscal Year] = vYear
            && Table1[Fiscal Period] <= vPeriod
    )
VAR vResult =
    vBegBal + SUMX ( vTable, Table1[NetChange] )
RETURN
    vResult

 

DataInsights_0-1628170380333.png

 





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

Proud to be a Super User!




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.