Forum Discussion

4 Replies

  • 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
            )
    )