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

Opening and closing balance calculations

Hi Team,

 

i would like to calculate the opening and closing balance based on the below table.

Can someone help me how can I do it.

Table1

PeriodMonthFTE
1Jul500

 

Table2

PeriodMonthNew JoinerExit
1Jul54
2Aug105
3Sep89

 

result i want to arrive.

1. July opening balance will be the 500(Table1)+5 New joiner(table2)+4Exit(Table2)=Closing Balance.
2. Aug month Opening balance has to come from July month Closing balance.

 

JulyAugSept
Opening balanceNew JoinerExitClosing balanceOpening balanceNew JoinerExitClosing balanceOpening balanceNew JoinerExitClosing balance
50054501(100+4-4)501105506(501+10-5)50689505(506+8-9)

 

RanjanThammaiah_0-1695204459954.png

 

Any help is greatly appreciated.

 

Regards,

Ranjan

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @RanjanThammaiah,

You can try to use the following measure formula if they suitable for your requirement:

Closing Balance =
VAR currDate =
    MAX ( DateTable[Date] )
VAR initAmount =
    SUMX (
        FILTER ( ALLSELECTED ( Table1 ), DATEVALUE ( [Month] & "/1" ) <= currDate ),
        [FTE]
    )
VAR rolling =
    CALCULATE (
        SUM ( Table2[New Joiner] ) - SUM ( Table2[Exit] ),
        FILTER ( ALLSELECTED ( Table2 ), DATEVALUE ( [Month] & "/1" ) <= currDate )
    )
RETURN
    initAmount + rolling

Opening Balance =
VAR currDate =
    MAX ( DateTable[Date] )
VAR initAmount =
    SUMX (
        FILTER (
            ALLSELECTED ( Table1 ),
            DATEVALUE ( [Month] & "/1" )
                < DATE ( YEAR ( currDate ), MONTH ( currDate ), 1 )
        ),
        [FTE]
    )
VAR rolling =
    CALCULATE (
        SUM ( Table2[New Joiner] ) - SUM ( Table2[Exit] ),
        FILTER (
            ALLSELECTED ( Table2 ),
            DATEVALUE ( [Month] & "/1" )
                < DATE ( YEAR ( currDate ), MONTH ( currDate ), 1 )
        )
    )
RETURN
    initAmount + rolling

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

1 REPLY 1
v-shex-msft
Community Support
Community Support

Hi @RanjanThammaiah,

You can try to use the following measure formula if they suitable for your requirement:

Closing Balance =
VAR currDate =
    MAX ( DateTable[Date] )
VAR initAmount =
    SUMX (
        FILTER ( ALLSELECTED ( Table1 ), DATEVALUE ( [Month] & "/1" ) <= currDate ),
        [FTE]
    )
VAR rolling =
    CALCULATE (
        SUM ( Table2[New Joiner] ) - SUM ( Table2[Exit] ),
        FILTER ( ALLSELECTED ( Table2 ), DATEVALUE ( [Month] & "/1" ) <= currDate )
    )
RETURN
    initAmount + rolling

Opening Balance =
VAR currDate =
    MAX ( DateTable[Date] )
VAR initAmount =
    SUMX (
        FILTER (
            ALLSELECTED ( Table1 ),
            DATEVALUE ( [Month] & "/1" )
                < DATE ( YEAR ( currDate ), MONTH ( currDate ), 1 )
        ),
        [FTE]
    )
VAR rolling =
    CALCULATE (
        SUM ( Table2[New Joiner] ) - SUM ( Table2[Exit] ),
        FILTER (
            ALLSELECTED ( Table2 ),
            DATEVALUE ( [Month] & "/1" )
                < DATE ( YEAR ( currDate ), MONTH ( currDate ), 1 )
        )
    )
RETURN
    initAmount + rolling

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

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.