Index: app/main.py
===================================================================
--- app/main.py	(revision 16e7e837dd7edfe3f101dc873e6c118d5be09536)
+++ app/main.py	(revision 04e01b0fb4b77eee9734b796b83913336fa50cc4)
@@ -840,2 +840,87 @@
         )
 
+@app.get("/reports/exceeding-transactions", response_model=List[dict])
+def get_exceeding_transactions(
+    account_name: Optional[str] = None,  # Allow filtering by account name
+    user: User = Depends(get_current_user),
+    db: Session = Depends(get_db)
+):
+    """
+    Retrieve a list of transactions that exceeded the balance of an account, sorted chronologically.
+    - Admins can view for all users.
+    - Regular users can view for their own accounts.
+    """
+    # Define the subquery to calculate `calculated_balance` using a window function
+    subquery = (
+        db.query(
+            Transaction.transaction_id,
+            Transaction.transaction_name,
+            Transaction.date.label("transaction_date"),
+            TransactionAccount.account_name,
+            User.user_id,
+            User.user_name,
+            TransactionBreakdown.spent_amount.label("transaction_amount"),
+            func.sum(TransactionBreakdown.earned_amount - TransactionBreakdown.spent_amount)
+            .over(
+                partition_by=TransactionBreakdown.transaction_account_id,
+                order_by=Transaction.date
+            )
+            .label("calculated_balance"),
+        )
+        .join(TransactionAccount, TransactionAccount.transaction_account_id == TransactionBreakdown.transaction_account_id)
+        .join(User, TransactionAccount.user_id == User.user_id)
+        .join(Transaction, Transaction.transaction_id == TransactionBreakdown.transaction_id)
+        .subquery()
+    )
+
+    query = db.query(
+        subquery.c.transaction_id,
+        subquery.c.transaction_name,
+        subquery.c.transaction_date,
+        subquery.c.account_name,
+        subquery.c.user_id,
+        subquery.c.user_name,
+        subquery.c.transaction_amount,
+        subquery.c.calculated_balance,
+    ).filter(
+        subquery.c.transaction_amount > subquery.c.calculated_balance,  # Filter where transaction amount exceeds balance
+        subquery.c.transaction_amount > 0,  # Filter for positive transactions
+    )
+
+    if account_name:
+        query = query.filter(subquery.c.account_name == account_name)
+
+    # Apply user-specific filtering for non-admins
+    if not is_admin(user.email):
+        query = query.filter(subquery.c.user_id == user.user_id)
+
+    # Order results
+    query = query.order_by(
+        subquery.c.user_id,
+        subquery.c.account_name,
+        subquery.c.transaction_date.desc(),
+    )
+
+    # Execute the query and fetch results
+    results = query.all()
+
+    if not results:
+        return []
+
+    # Prepare response
+    response = [
+        {
+            "user_id": row.user_id,
+            "user_name": row.user_name,
+            "account_name": row.account_name,
+            "transaction_id": row.transaction_id,
+            "transaction_name": row.transaction_name,
+            "transaction_amount": row.transaction_amount,
+            "transaction_date": row.transaction_date,
+            "calculated_balance": row.calculated_balance,
+        }
+        for row in results
+    ]
+
+    return response
+
Index: cli/cli_app.py
===================================================================
--- cli/cli_app.py	(revision 16e7e837dd7edfe3f101dc873e6c118d5be09536)
+++ cli/cli_app.py	(revision 04e01b0fb4b77eee9734b796b83913336fa50cc4)
@@ -413,4 +413,5 @@
         print("2. View Spending by Category")
         print("3. View Spending by Date Range")
+        print("4. View Transactions Exceeding Account Balance")
         choice = input("Choose a report option: ")
 
@@ -421,4 +422,6 @@
         elif choice == "3":
             get_spending_by_date_range()
+        elif choice == "4":
+            get_exceeding_account_balance()
         elif choice == "0":
             break
@@ -498,4 +501,40 @@
         print(f"Request failed: {e}")
 
+def get_exceeding_account_balance():
+    headers = {"Authorization": f"Bearer {access_token}"}
+
+    print("\nTransactions Exceeding Account Balance Report")
+    account_name = input("Enter account name (leave blank for all accounts): ")
+    params = {"account_name": account_name} if account_name else {}
+    
+    try:
+        response = requests.get(
+            f"{BASE_URL}/reports/exceeding-transactions",
+            params=params,
+            headers=headers
+        )
+
+        if response.status_code == 200:
+            records = response.json()
+            if not records:
+                print("No transactions exceeding account balance were found.")
+            else:
+                print("\nExceeding Transactions:")
+                for record in records:
+                    print("-" * 50)
+                    print(f"User ID: {record['user_id']}")
+                    print(f"User Name: {record['user_name']}")
+                    print(f"Account Name: {record['account_name']}")
+                    print(f"Transaction ID: {record['transaction_id']}")
+                    print(f"Transaction Name: {record['transaction_name']}")
+                    print(f"Transaction Amount: {float(record['transaction_amount']):,.2f}")
+                    print(f"Transaction Date: {record['transaction_date']}")
+                    print(f"Calculated Balance: {float(record['calculated_balance']):,.2f}")
+                    print("-" * 50)
+        else:
+            print("Failed to fetch the exceeding transactions report.")
+            print(f"Error: {response.json().get('detail', 'Unknown error')}")
+    except requests.exceptions.RequestException as e:
+        print(f"Request failed: {e}")
 
 if __name__ == "__main__":
