Forum Discussion
Vignesharavind
5 months agoNew Member
Dax logic for Amortization Calculation
I have a dataset and a unique requirement that needs to be applied to powerBi.I need calculation for amortization logic.
Raw data and desired matrix is provided in picture.
Thanks for the help,in advance
4 Replies
- rohit1991Super User
Hii Vignesharavind
Use a row-wise calculation that spreads each record’s amount evenly across its valid period and only returns value for dates within that range, ensuring correct totals in a matrix. Use a proper Date table (mandatory), ensure a relationship between Date table and fact table, use DATEDIFF for duration logic, and SUMX for row-wise amortization.
Amortization = SUMX ( Data, VAR StartDate = Data[Start Date] VAR EndDate = Data[End Date] VAR Amount = Data[Amount] VAR Months = DATEDIFF ( StartDate, EndDate, MONTH ) + 1 VAR CurrMonth = MAX ( 'Date'[Date] ) RETURN IF ( CurrMonth >= StartDate && CurrMonth <= EndDate, DIVIDE ( Amount, Months ), 0 ) )- VignesharavindNew Member
Thanks
- danextianSuper User
- VignesharavindNew Member
Thanks for the help It worked