Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Create table displaying weighted averages of various data points for two accounts

Given the first table with stocks, portfolio weights, and stock statistics, how can I use Power BI to populate and display the second table? I'm new to this, and am able to create a New Measure that shows Portfolio 1's dividend yield. Would I need to create a new measure for each data point for each portfolio, or is there a shorter way? Thanks in advance!

 

StockPortfolio 1 WeightPortfolio 2 WeightPriceDividend YieldEVBasic EPSP/EDebt/AssetsROE
TSLA US EQUITY15.0%25.0%162.270.000.504.7372.988.9824.22
MSFT US EQUITY25.0%40.0%408.350.733.069.7236.9419.2839.17
PRU US EQUITY12.5%4.0%112.394.630.056.769.723.598.25
V US EQUITY20.0%20.0%276.200.750.5710.6831.3323.1848.67
T US EQUITY10.0%1.0%16.916.570.281.977.2838.9213.15
CSCO US EQUITY17.5%10.0%48.253.320.183.0814.089.24

30.65

 

 

 

 Portfolio 1Portfolio 2
Price  
Dividend Yield  
EV  
Basic EPS  
P/E  
Debt/Assets  
ROE  
1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

Hi @Anonymous 

Here's how I would set this up (PBIX attached).

 

1. Set up model as shown:

OwenAuger_0-1713991626087.png

Portfolio

OwenAuger_1-1713991646370.png

 

Stock

OwenAuger_2-1713991658709.png

 

Metric

OwenAuger_3-1713991679039.png

 

Portfolio Weight

OwenAuger_4-1713991706115.png

 

Stock Metric

OwenAuger_5-1713991720714.png

 

2. Create these measures

# Metrics = 
COUNTROWS ( Metric )
# Portfolios = 
COUNTROWS ( Portfolio )
Metric Value = 
-- Ensure only aggregating one metric
IF (
    [# Metrics] = 1,
    AVERAGE ( 'Stock Metric'[Value] )
)
Weighted Metric Value = 
-- Ensure only aggregating one portfolio
IF (
    [# Portfolios] = 1,
    SUMX (
        'Portfolio Weight',
        [Metric Value] * 'Portfolio Weight'[Weight]
    )
)

3. Create test matrix visual:

  • Rows: Metric[Metric]
  • Columns: Portfolio[Portfolio]
  • Values: [Weighted Metric Value]

OwenAuger_6-1713991909233.png

This is a start anyway. You may well want to extend with measures that aggregate Portfolios or perform other calculations.

 

Does that help?

 

Regards,

 

 


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

View solution in original post

2 REPLIES 2
OwenAuger
Super User
Super User

Hi @Anonymous 

Here's how I would set this up (PBIX attached).

 

1. Set up model as shown:

OwenAuger_0-1713991626087.png

Portfolio

OwenAuger_1-1713991646370.png

 

Stock

OwenAuger_2-1713991658709.png

 

Metric

OwenAuger_3-1713991679039.png

 

Portfolio Weight

OwenAuger_4-1713991706115.png

 

Stock Metric

OwenAuger_5-1713991720714.png

 

2. Create these measures

# Metrics = 
COUNTROWS ( Metric )
# Portfolios = 
COUNTROWS ( Portfolio )
Metric Value = 
-- Ensure only aggregating one metric
IF (
    [# Metrics] = 1,
    AVERAGE ( 'Stock Metric'[Value] )
)
Weighted Metric Value = 
-- Ensure only aggregating one portfolio
IF (
    [# Portfolios] = 1,
    SUMX (
        'Portfolio Weight',
        [Metric Value] * 'Portfolio Weight'[Weight]
    )
)

3. Create test matrix visual:

  • Rows: Metric[Metric]
  • Columns: Portfolio[Portfolio]
  • Values: [Weighted Metric Value]

OwenAuger_6-1713991909233.png

This is a start anyway. You may well want to extend with measures that aggregate Portfolios or perform other calculations.

 

Does that help?

 

Regards,

 

 


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn
Anonymous
Not applicable

Fantastic. Thanks so much!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.