Hi there,
I want to know if there's a way to brake-down to components a data table according to weight?
I have a portfolio of equities and etf's (table 1) , and I want that every ETF in it will be 'opened' according to the weights (table 3) of its related index (table 2) , so I'll get a table like in the 'Desired Query'.
Is that doable?
Thanks in advance
Table 1
<tbody>
</tbody>
Table 2
<tbody>
</tbody>
Table 4
<tbody>
</tbody>
Desired Query result
<tbody>
</tbody>
I want to know if there's a way to brake-down to components a data table according to weight?
I have a portfolio of equities and etf's (table 1) , and I want that every ETF in it will be 'opened' according to the weights (table 3) of its related index (table 2) , so I'll get a table like in the 'Desired Query'.
Is that doable?
Thanks in advance
Table 1
Portfolio components | Balance |
SPDR | 10,000 |
AAPL | 5,000 |
MSFT | 4,000 |
QQQ | 3,000 |
<tbody>
</tbody>
Table 2
Portfolio components | Linked Index |
SPDR | S&P500 |
QQQ | Nasdaq100 |
<tbody>
</tbody>
Table 4
Index | Sector | Weight |
S&P500 | Technology | 20% |
S&P500 | Energy | 40% |
S&P500 | Consumer Staples | 30% |
S&P500 | Consumer Discretionary | 10% |
Nasdaq100 | Technology | 15% |
Nasdaq100 | Energy | 15% |
Nasdaq100 | Consumer Staples | 30% |
Nasdaq100 | Consumer Discretionary | 40% |
<tbody>
</tbody>
Desired Query result
Portfolio components | Balance |
SPDR -Technology | 2,000 |
SPDR -Energy | 4,000 |
SPDR -Consumer Staples | 3,000 |
SPDR -Consumer Discretionary | 1,000 |
AAPL | 5,000 |
MSFT | 4,000 |
QQQ -Technology | 300 |
QQQ -Energy | 450 |
QQQ -Consumer Staples | 450 |
QQQ -Consumer Discretionary | 900 |
<tbody>
</tbody>
Last edited: