Skip to content

Commit 57ee0fc

Browse files
author
Harmanpreet Kaur
committed
asset value issue solved
1 parent efb28de commit 57ee0fc

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

ClientAdvisor/App/app.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,9 +1562,14 @@ def get_users():
15621562
SELECT c.ClientId, c.Client, c.Email, a.AssetValue, cs.ClientSummary
15631563
FROM Clients c
15641564
JOIN (
1565-
SELECT ClientId, SUM(Investment) AS AssetValue
1566-
FROM Assets
1567-
GROUP BY ClientId
1565+
SELECT a.ClientId, a.Investment AS AssetValue
1566+
FROM (
1567+
SELECT ClientId, sum(Investment) as Investment,
1568+
ROW_NUMBER() OVER (PARTITION BY ClientId ORDER BY AssetDate DESC) AS RowNum
1569+
FROM Assets
1570+
group by ClientId,AssetDate
1571+
) a
1572+
WHERE a.RowNum = 1
15681573
) a ON c.ClientId = a.ClientId
15691574
JOIN ClientSummaries cs ON c.ClientId = cs.ClientId
15701575
) ca

ClientAdvisor/AzureFunction/function_app.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ def get_SQL_Response(
110110
If asked, provide information about any recent changes in the client's investment allocations in the query.
111111
If asked about the client's portfolio performance over the last quarter, calculate the total investment by summing the investment amounts where AssetDate is greater than or equal to the date from one quarter ago using DATEADD(QUARTER, -1, GETDATE()) in the query.
112112
If asked about upcoming important dates or deadlines for the client, always ensure that StartTime is greater than the current date. Do not convert the formats of StartTime and EndTime and consistently provide the upcoming dates along with the scheduled times in the query.
113-
To determine the client's portfolio value, provide the total sum of all investments when asked for the asset value. For the current asset value, sum the investment values for the most recent available dates. When asked about the asset types in the portfolio and the total value of each, list each asset type with the total sum of investments for each category. If asked for the asset types in the portfolio and the present value of each, provide a list of each asset type with its most recent investment value.
113+
To determine the asset value, sum the investment values for the most recent available date. If asked for the asset types in the portfolio and the present of each, provide a list of each asset type with its most recent investment value.
114+
If the user inquires about asset on a specific date ,sum the investment values for the specific date avoid summing values from all dates prior to the requested date.If asked for the asset types in the portfolio and the value of each for specific date , provide a list of each asset type with specific date investment value avoid summing values from all dates prior to the requested date.
114115
Only return the generated sql query. do not return anything else'''
115116
try:
116117

0 commit comments

Comments
 (0)