F
Flofies
Hello my name is Carlos, this is the first question I post, if you need more
infro in order to provide some help, please let me know:
I'm creating a Database to obtain the profit / loss of my clients (mutual
funds)
so, with the data I have, I first created a table:
----------------------------------------------------------------------------+
PriceId |FundName| Series | Date | Price |
----------------------------------------------------------------------------+
001 |Fund01 | B1 | 01/01/2005 | 1.236598|
002 |Fund01 | B2 | 01/01/2005 | 1.236585|
003 |Fund01 | B3 | 01/01/2005 | 1.236523|
004 |Fund02 | B1 | 01/01/2005 | 2.369874|
005 |Fund02 | B2 | 01/01/2005 | 2.367796|
... ... ... ... ... |
... ... ... ... ... |
--------------------------------------------------------------------+
There are 8 different series (as of today)
There are 10 different Funds
In a same date I have a different price for each Fund on each Series
So, after following the rules of Normalization I ended up with the following
tables:
-----------------+ +---------------------------+ +--
------------------+
Fund_01 | | Series | | Dates
|
-----------------+ -----------------------------+
+--------------------+
PriceID | Price | |IdSeries | SerName | |DateId | Date
|
-----------------+ +---------------------------+ +-----
---------------+
0001 |1.236598| | 001 | B1 | | 001 |
01/01/2005 |
0002 |1.236451| | 002 | B2 | | 002 |
01/02/2005 |
0001 |1.234587| | 003 | C | | 003 |
01/03/2005 |
0001 |1.232231| | 004 | E | | 004 |
01/04/2005 |
... ... | | ... | ... | | .
.. | ... |
-----------------+ +----------------------------+ +--
------------------+
The formula to get the percentage of profit/loss is (((Fp-Ip)/Ip
)/P)*360
Where: Fp=Final price, Ip= Initial price, P= period expressed in days
So, I need help to:
1.-
Make sure I followed the rules of Normalization right.
2.- Create a query with calculated fields and aliases in order get something
like this:
+----------------------------+-----------------+------------------+-----------
----+-----------------+----------------+
| Customer_name | Fund_Name | Initial date | Final
date | Profit / Loss % |Profit / Loss $ |
+----------------------------+-----------------+------------------+-----------
----+-----------------+----------------+
| Smith, John | R & S 1000 | 01/01/2005 |
12/05/2005 | 5.86 | $ 1,236.15 |
| Roberts, Steve | TTN Plus | 06/21/2005 |
11/05/2006 | 2.35 | $ 913.00 |
| ... | ... | ... | ...
| ... | ... |
-----------------------------+-----------------+------------------+-----------
----+-----------------+----------------+
I already have the table with all the data of the Customers, but that's an
issue I can handle.
Thanks in advance
infro in order to provide some help, please let me know:
I'm creating a Database to obtain the profit / loss of my clients (mutual
funds)
so, with the data I have, I first created a table:
----------------------------------------------------------------------------+
PriceId |FundName| Series | Date | Price |
----------------------------------------------------------------------------+
001 |Fund01 | B1 | 01/01/2005 | 1.236598|
002 |Fund01 | B2 | 01/01/2005 | 1.236585|
003 |Fund01 | B3 | 01/01/2005 | 1.236523|
004 |Fund02 | B1 | 01/01/2005 | 2.369874|
005 |Fund02 | B2 | 01/01/2005 | 2.367796|
... ... ... ... ... |
... ... ... ... ... |
--------------------------------------------------------------------+
There are 8 different series (as of today)
There are 10 different Funds
In a same date I have a different price for each Fund on each Series
So, after following the rules of Normalization I ended up with the following
tables:
-----------------+ +---------------------------+ +--
------------------+
Fund_01 | | Series | | Dates
|
-----------------+ -----------------------------+
+--------------------+
PriceID | Price | |IdSeries | SerName | |DateId | Date
|
-----------------+ +---------------------------+ +-----
---------------+
0001 |1.236598| | 001 | B1 | | 001 |
01/01/2005 |
0002 |1.236451| | 002 | B2 | | 002 |
01/02/2005 |
0001 |1.234587| | 003 | C | | 003 |
01/03/2005 |
0001 |1.232231| | 004 | E | | 004 |
01/04/2005 |
... ... | | ... | ... | | .
.. | ... |
-----------------+ +----------------------------+ +--
------------------+
The formula to get the percentage of profit/loss is (((Fp-Ip)/Ip
)/P)*360
Where: Fp=Final price, Ip= Initial price, P= period expressed in days
So, I need help to:
1.-
Make sure I followed the rules of Normalization right.
2.- Create a query with calculated fields and aliases in order get something
like this:
+----------------------------+-----------------+------------------+-----------
----+-----------------+----------------+
| Customer_name | Fund_Name | Initial date | Final
date | Profit / Loss % |Profit / Loss $ |
+----------------------------+-----------------+------------------+-----------
----+-----------------+----------------+
| Smith, John | R & S 1000 | 01/01/2005 |
12/05/2005 | 5.86 | $ 1,236.15 |
| Roberts, Steve | TTN Plus | 06/21/2005 |
11/05/2006 | 2.35 | $ 913.00 |
| ... | ... | ... | ...
| ... | ... |
-----------------------------+-----------------+------------------+-----------
----+-----------------+----------------+
I already have the table with all the data of the Customers, but that's an
issue I can handle.
Thanks in advance