Forum Discussion
ayana
2 years agoFrequent Visitor
Calculated column to apply values from a different column
I'm working with debt collection data and I have a problem I hope someone can help resolve. Scenario: When there are several missed payments and a collection is made, it is applied to the oldest miss...
- Anonymous2 years ago
Hi ayana
Please try creating “CreditedAmount” column with the following DAX:
CreditAmount = VAR CurrentMissedPaymentID = 'DataTable'[MissedPaymentID] VAR CumulativeCollectedAmount = CALCULATE( SUM('DataTable'[CollectedAmount]), FILTER( ALL('DataTable'), 'DataTable'[Month] <= EARLIER('DataTable'[Month]) ) ) VAR PreviousCumulativeMissedPmts = CALCULATE( MAX('DataTable'[CumulativeMissedPmts]), FILTER( 'DataTable', 'DataTable'[MissedPaymentID] = CurrentMissedPaymentID - 1 ) ) RETURN IF( CumulativeCollectedAmount - 'DataTable'[CumulativeMissedPmts] >= 0, 'DataTable'[MsdPmtAmount], MAX(0, CumulativeCollectedAmount - PreviousCumulativeMissedPmts) )Here is my test result, i hope this can meet your requirement.
Best Regards,
Jarvis Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
2 years agoNot applicable
Hi ayana
Please try creating “CreditedAmount” column with the following DAX:
CreditAmount =
VAR CurrentMissedPaymentID = 'DataTable'[MissedPaymentID]
VAR CumulativeCollectedAmount =
CALCULATE(
SUM('DataTable'[CollectedAmount]),
FILTER(
ALL('DataTable'),
'DataTable'[Month] <= EARLIER('DataTable'[Month])
)
)
VAR PreviousCumulativeMissedPmts =
CALCULATE(
MAX('DataTable'[CumulativeMissedPmts]),
FILTER(
'DataTable',
'DataTable'[MissedPaymentID] = CurrentMissedPaymentID - 1
)
)
RETURN
IF(
CumulativeCollectedAmount - 'DataTable'[CumulativeMissedPmts] >= 0,
'DataTable'[MsdPmtAmount],
MAX(0, CumulativeCollectedAmount - PreviousCumulativeMissedPmts)
)
Here is my test result, i hope this can meet your requirement.
Best Regards,
Jarvis Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.