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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
525
New Member

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 @525 

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
Twitter
LinkedIn

View solution in original post

2 REPLIES 2
OwenAuger
Super User
Super User

Hi @525 

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
Twitter
LinkedIn

Fantastic. Thanks so much!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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