I am creating an Excel database of my 401k stock portfolio. I have the following tables (all formatted as Excel tables):
/* All the different stocks that are available to invest. */
Funds (stock_symbol, fund_name, fund_description)
/* Prices for each fund for every date since start of employment. */
SharePrices (share_price_date, stock_symbol, price_per_share)
Data Validation constraint: all values of stock_symbol must exist in Funds.
/* Three valid transaction_types:
share_purchase: purchase of shares of stock, usually happens once every pay period.
interfund_transfer: transfer of funds from one stock to another. requires
two transactions: one for selling the stocks, one for purchase the
equivalent amount of another stock.
fees: payment of fees is done by removing very small amounts of shares.
*/
TransactionTypes (transaction_type, transaction_type_description)
/* Two contribution accounts:
employee_contributions: Money I put into the database
employer_contributions: Money my employer matches.
*/
ContributionAccounts (contribution_account_name, contribution_account_description)
/* Shows all transactions (buying and selling of shares) that have occurred since start of employment */
ShareTransactions (transaction_date, transaction_type, contribution_account_name, stock_symbol, number_of_shares_bought_or_sold)
Data Validation constraint: all values of transaction_type must exist in TransactionTypes.
Data Validation constraint: all values of contribution_account_name must exist in ContributionAccounts.
/* The main table of the database. Displays the balance of an account for a stock fund on a certain date. */
ShareBalances(share_price_date, stock_symbol, share_price, contribution_account_name, balance_in_number_of_shares, balance_in_dollars)
Data Validation constraint: all values of stock_symbol must exist in Funds.
Data Validation constraint: all values of contribution_account_name must exist in ContributionAccounts.
So here is a sample of records in my ShareBalances table:
<table>
<tr>
<th>Date</th>
<th>Stock Symbol</th>
<th>Share Price</th>
<th>Contribution Account Name</th>
<th>Number of Shares</th>
<th>Amount</th>
</tr>
<tr>
<td>11/29/2018</td>
<td>vexrx</td>
<td>96.46</td>
<td>employee_contributions</td>
<td>173.995</td>
<td>$16,783.56</td>
</tr>
<tr>
<td>11/29/2018</td>
<td>vexrx</td>
<td>96.46</td>
<td>employer_contributions</td>
<td>165.029</td>
<td>$15,918.70</td>
</tr>
<tr>
<td>11/30/2018</td>
<td>vexrx</td>
<td>97.05</td>
<td>employee_contributions</td>
<td>173.995</td>
<td>$16,886.21</td>
</tr>
<tr>
<td>11/30/2018</td>
<td>vexrx</td>
<td>97.05</td>
<td>employer_contributions</td>
<td>165.029</td>
<td>$16,016.06</td>
</tr>
</table>
So now I have some questions:
I want to create an Excel chart that displays the daily balances of two series: employee_contributions and employer_contributions. How do I do that? Do I have to redo my ShareBalances table so that I add two columns: EmployeeContributionBalance and EmployerContributionBalance and get rid of Account, like so:
<table>
<tr>
<th>Date</th>
<th>Stock Symbol</th>
<th>Share Price</th>
<th>EmployeeContribution Share Balance</th>
<th>EmployerContribution Share Balance</th>
<th>EmployeeContribution Dollar Balance</th>
<th>EmployerContribution Dollar Balance</th>
</tr>
</table>
This would give me a way to create my chart, but it can't be right, though. I don't want to have to restructure the entire table if at some point in the future I have to add another account. What is the correct way to do this?
Also, I am open to any other ideas anyone might have on improving this thing. Can I implement a pivot table in some way?
/* All the different stocks that are available to invest. */
Funds (stock_symbol, fund_name, fund_description)
/* Prices for each fund for every date since start of employment. */
SharePrices (share_price_date, stock_symbol, price_per_share)
Data Validation constraint: all values of stock_symbol must exist in Funds.
/* Three valid transaction_types:
share_purchase: purchase of shares of stock, usually happens once every pay period.
interfund_transfer: transfer of funds from one stock to another. requires
two transactions: one for selling the stocks, one for purchase the
equivalent amount of another stock.
fees: payment of fees is done by removing very small amounts of shares.
*/
TransactionTypes (transaction_type, transaction_type_description)
/* Two contribution accounts:
employee_contributions: Money I put into the database
employer_contributions: Money my employer matches.
*/
ContributionAccounts (contribution_account_name, contribution_account_description)
/* Shows all transactions (buying and selling of shares) that have occurred since start of employment */
ShareTransactions (transaction_date, transaction_type, contribution_account_name, stock_symbol, number_of_shares_bought_or_sold)
Data Validation constraint: all values of transaction_type must exist in TransactionTypes.
Data Validation constraint: all values of contribution_account_name must exist in ContributionAccounts.
/* The main table of the database. Displays the balance of an account for a stock fund on a certain date. */
ShareBalances(share_price_date, stock_symbol, share_price, contribution_account_name, balance_in_number_of_shares, balance_in_dollars)
Data Validation constraint: all values of stock_symbol must exist in Funds.
Data Validation constraint: all values of contribution_account_name must exist in ContributionAccounts.
So here is a sample of records in my ShareBalances table:
<table>
<tr>
<th>Date</th>
<th>Stock Symbol</th>
<th>Share Price</th>
<th>Contribution Account Name</th>
<th>Number of Shares</th>
<th>Amount</th>
</tr>
<tr>
<td>11/29/2018</td>
<td>vexrx</td>
<td>96.46</td>
<td>employee_contributions</td>
<td>173.995</td>
<td>$16,783.56</td>
</tr>
<tr>
<td>11/29/2018</td>
<td>vexrx</td>
<td>96.46</td>
<td>employer_contributions</td>
<td>165.029</td>
<td>$15,918.70</td>
</tr>
<tr>
<td>11/30/2018</td>
<td>vexrx</td>
<td>97.05</td>
<td>employee_contributions</td>
<td>173.995</td>
<td>$16,886.21</td>
</tr>
<tr>
<td>11/30/2018</td>
<td>vexrx</td>
<td>97.05</td>
<td>employer_contributions</td>
<td>165.029</td>
<td>$16,016.06</td>
</tr>
</table>
So now I have some questions:
I want to create an Excel chart that displays the daily balances of two series: employee_contributions and employer_contributions. How do I do that? Do I have to redo my ShareBalances table so that I add two columns: EmployeeContributionBalance and EmployerContributionBalance and get rid of Account, like so:
<table>
<tr>
<th>Date</th>
<th>Stock Symbol</th>
<th>Share Price</th>
<th>EmployeeContribution Share Balance</th>
<th>EmployerContribution Share Balance</th>
<th>EmployeeContribution Dollar Balance</th>
<th>EmployerContribution Dollar Balance</th>
</tr>
</table>
This would give me a way to create my chart, but it can't be right, though. I don't want to have to restructure the entire table if at some point in the future I have to add another account. What is the correct way to do this?
Also, I am open to any other ideas anyone might have on improving this thing. Can I implement a pivot table in some way?