Forum Discussion

badger007's avatar
badger007
Frequent Visitor
2 years ago

Portfolio Variance - matrix multiplication

Hi guys,

 

Need your help.

I have a portfolio with various accounts each of which has some products (called risk_curve_month_name in my datasets).

My goal is to be able to calculate portfolio variance based on what accounts were selected (one or a few).

Portfolio variance is calculated through the multiplication of the transposed vector of asset weights by the variance-covariance matrix and multiplied by the vector of asset weights again (this time not transposed).

The weights of assets are already calculated in my power bi: quantity (called exposure in my dataset) * price * variance.

The tricky part is that the variance-covariance matrix consists of all possible combinations of the products. However, some accounts only have a couple of products. So before doing the matrix multiplication, the variance-covariance matrix must be filtered first.
Below are snips of my power bi and my example calculation in excel using MMULT and Transpose functions (see the formula bar on the snip).

 

It's probably confusing. So please ask me a question if anything is unclear.

 

Many thanks for your time and help. Hope you can help me 🙂

 

3 Replies