Calculated column to sum most recently dated related records for each given date

sengenbe

New Member
Joined
Nov 24, 2009
Messages
3
Hello everyone,
I'm new to Power BI from heavy Excel use and have been hacking away learning some of the basic functionality. I've run into a complicated situation that has me stumped on how to tackle.

I have a list of loans that are related via a "parent" (which basically means the first loan) and a number of child loans, which could be any number. My data contains the balances of each loan when the balance changes (system generated and there are too many underlying transactions to do this with transaction-level data). The balance changes may occur on any date and while they tend to occur on the same day, sometimes they do not. I need a column which sums the most recent balance record for the given date. I've mocked it up in the data below as ParentLevelPrincipalBalance. The logic would be:

For each row, sum the most recent PrincipalBalance record for each loan within the parent group ("Parent if parent" column) that is dated equal to or less than the row's BalanceDate.

As an example, the sum of the balances are $0 on 12/31/20 , then on 1/1/2020 the new balance record for loan 0001A would be used in the sum process. This wouldn't be too difficult to pull off in a VBA loop but I'm not sure how to do it in DAX. Is there a way to use filtering to isolate the 3 loans' most recent records relative to the balance date in the 0001A parent group and sum those?

The second, related situation is that the loans are related through LoanGroup, which is basically the same concept but can combine multiple parent groups in the LoanGroupPrincipalBalance.

I hope that I've described this clearly enough to be helpful. Thank you very much!

LoanNumberParentLoanParent if ParentBalanceDatePrincipalBalanceLoanGroupParentLevelPrincipalBalanceLoanGroupPrincipalBalance
0001A0001A
12/31/2020​
$ -CLIENT ONE$ -$ -
0001B0001A0001A
12/31/2020​
$ -CLIENT ONE$ -$ -
0001C0001A0001A
12/31/2020​
$ -CLIENT ONE$ -$ -
0002A0002A
1/13/2020​
$ 50,000.00CLIENT ONE$ 50,000.00$ 50,000.00
0001A0001A
1/1/2021​
$ 100,000.00CLIENT ONE$ 100,000.00$ 150,000.00
0001B0001A0001A
3/31/2021​
$ 25,000.00CLIENT ONE$ 125,000.00$ 175,000.00
0001C0001A0001A
4/30/2021​
$ 10,000.00CLIENT ONE$ 135,000.00$ 185,000.00
0002A0002A
5/31/2021​
$ 49,000.00CLIENT ONE$ 49,000.00$ 184,000.00
0001A0001A
6/30/2021​
$ 99,000.00CLIENT ONE$ 146,000.00$ 195,000.00
0001B0001A0001A
6/30/2021​
$ 24,000.00CLIENT ONE$ 146,000.00$ 195,000.00
0001C0001A0001A
6/30/2021​
$ 23,000.00CLIENT ONE$ 146,000.00$ 195,000.00
0003A0003A
7/1/2021​
$ 400,000.00CLIENT TWO$ 400,000.00$ 400,000.00

Power BI Test.png
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

Forum statistics

Threads
1,224,823
Messages
6,181,179
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top