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
Anonymous
Not applicable

Need help with circular reference calculation using varying percentages

Need experts help here as have been banging my head against this for awhile.  Tried using @OwenAuger s circular reference calculation but was unable to as my issue has percentages.  Here is the issue i need to do a simple amortization of a balance.

 

i have one table containing the amortization in percetages with a time index. See below:

Data2.PNG

I have another table with the balance:

 

Balance.PNG

 

All i want is to apply -.1*1,000,000=900,000 for the first time period then for the second time period start with 900,000 and multiply that by -0.2.

 

Here is what i can come up with, as you can see it's not working right.

 

Amort Table.PNG

The Amort measure is as below:

AmortCalc =
(-[Initial Balnce Measure2]*[Market Factor])
 
I cant change it to reference the closing balance as it creates a circular reference.  

Closing Balance calculation is as below:
Closing Balance =
[Initial Balnce Measure2]+[Amort Cumulative]
 
I realize there must be a simple answer to this.  Appreciate your help!





1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

Hi @Anonymous 

 

Attached is an example of how I would handle this.

 

The main requirement is to calculate the Closing Balance first by taking a cumulative product of (1-Factor) multiplied by the Initial Principal.

 

  1. I set up data model like this:image.png

     

  2. Created these measures:
    Principal Sum = 
    SUM ( Principal[Initial Principal] )
    
    Closing Balance = 
    VAR MaxTime =
        MAX ( 'Time'[Time Index] )
    RETURN
        SUMX ( 
            'ID',
            VAR PrincipalSum = [Principal Sum]
            VAR ClosingBalance =
                PrincipalSum * 
                CALCULATE (
                    PRODUCTX (
                        AmortizationPercentages,
                        (1 - AmortizationPercentages[Factor] )
                    ),
                    'Time'[Time Index] <= MaxTime,
                    ALL ( 'Time' )
                )
            RETURN
                ClosingBalance
        )
    
    Opening Balance = 
    VAR MaxTime =
        MAX ( 'Time'[Time Index] )
    VAR OpeningBalance =
        IF (
            MaxTime = 1,
            [Principal Sum],
            CALCULATE ( 
                [Closing Balance],
                ALL ( 'Time' ),
                'Time'[Time Index] = MaxTime - 1
            )
        )
    RETURN
        OpeningBalance
    
    AmortCalc = 
    [Closing Balance] - [Opening Balance]
  3. Then you can visualize similar to what you posted:image.png

     

The above measures should aggregate correctly across multiple IDs but I haven't tested that.

 

Hopefully that's some help 🙂

 

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

View solution in original post

2 REPLIES 2
OwenAuger
Super User
Super User

Hi @Anonymous 

 

Attached is an example of how I would handle this.

 

The main requirement is to calculate the Closing Balance first by taking a cumulative product of (1-Factor) multiplied by the Initial Principal.

 

  1. I set up data model like this:image.png

     

  2. Created these measures:
    Principal Sum = 
    SUM ( Principal[Initial Principal] )
    
    Closing Balance = 
    VAR MaxTime =
        MAX ( 'Time'[Time Index] )
    RETURN
        SUMX ( 
            'ID',
            VAR PrincipalSum = [Principal Sum]
            VAR ClosingBalance =
                PrincipalSum * 
                CALCULATE (
                    PRODUCTX (
                        AmortizationPercentages,
                        (1 - AmortizationPercentages[Factor] )
                    ),
                    'Time'[Time Index] <= MaxTime,
                    ALL ( 'Time' )
                )
            RETURN
                ClosingBalance
        )
    
    Opening Balance = 
    VAR MaxTime =
        MAX ( 'Time'[Time Index] )
    VAR OpeningBalance =
        IF (
            MaxTime = 1,
            [Principal Sum],
            CALCULATE ( 
                [Closing Balance],
                ALL ( 'Time' ),
                'Time'[Time Index] = MaxTime - 1
            )
        )
    RETURN
        OpeningBalance
    
    AmortCalc = 
    [Closing Balance] - [Opening Balance]
  3. Then you can visualize similar to what you posted:image.png

     

The above measures should aggregate correctly across multiple IDs but I haven't tested that.

 

Hopefully that's some help 🙂

 

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn
Anonymous
Not applicable

Wow amazing!  Let me try this out today and work it out.  Am sure it will work.  Thanks for your help @OwenAuger !!

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.