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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.