For CAPM Beta

Taken individual beta for each stock and multiplied it with the weight of each stock in the portfolio. Sum up the product of each stock beta and its weight to get CAPM BETA

Total risk

Calculate the variance and covariance matrix using covariance in the data analytics option. Perform Mmult function for the transpose of the weight matrix, covariance matrix and then gain with weight matrix without transpose. You will get the total risk of the portfolio.

Systematic risk

Calculate the portfolio expected return then divide it by market return

Idiosyncratic risk

Sum of the variance of all the stocks divided by the number of stock

R-square

Calculate the correlation of each stock with the market and multiply it with the weight. Do summation of the square of the product.

I love reading through an article that will make people think. Also, thank you for allowing me to comment!