Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Weighted Average Yield to Maturity

Hello,

 

I would like to make a table like Image 1 that shows the weighted average Yield to maturity for various portfolios.  The data I am working with looks like the below image 2.

 

Image 1:

 

In Excel I use the formula =SUMPRODUCT(--(Days Remaining>0),Yield,Amount)/SUMIF(Days Remaining,">0",Amount)

basically the calculation is the sum of the products of yield % times the amount for each investment that hasn;t matured yet.  Days remaining is also a calculation: [maturity date-Today()]

And each portfolio has it's own individual calculation, we just cell reference them on a different table to see them together.

 

The important part is that I only want to perform this calculation for maturity dates in the future, or in other words where days remaining is greater than 0

How do I recreate this formula in Power BI?

 

Image 2:

Thank you for your help

  • Anonymous's avatar
    Anonymous
    4 years ago

    Thank you but this formula seemed to work to create a measure that could then be placed into a table

     

    Wtd Avg YTM = DIVIDE(SUMX(Data,Data[Yield]*Data[Amount]),SUM(Data[Amount]))

2 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you but this formula seemed to work to create a measure that could then be placed into a table

       

      Wtd Avg YTM = DIVIDE(SUMX(Data,Data[Yield]*Data[Amount]),SUM(Data[Amount]))