Streamline Financial Analysis with MindsDB’s Knowledge Bases and Hybrid Search
Streamline Financial Analysis with MindsDB’s Knowledge Bases and Hybrid Search

Chandre Van Der Westhuizen, Community & Marketing Co-ordinator at MindsDB
Oct 28, 2025


Finance teams are expected to deliver real-time, audit-ready insights — but their data still lives across disconnected systems like Salesforce, ERP, and spreadsheets. This creates delays, compliance risks, and manual effort in reporting and reconciliation. MindsDB solves this by unifying all financial data in place — no ETL, no copying — through AI-native Knowledge Bases, Hybrid Search, and Agents. The result: a single, explainable layer for querying invoices, orders, opportunities, and financial reports in real time. Finance leaders can now ask natural questions, trace every answer to source data, and ensure decisions are both accurate and compliant — all from one secure, intelligent platform.
Finance teams at publicly traded B2B companies juggle dozens of systems—from financial reports and CRM dashboards to invoices, shipments, and contracts.
Each tells part of the story, but the real insight lies across them:
How does revenue growth relate to delayed shipments or unpaid invoices?
Which large enterprise accounts contribute most to quarterly performance?
What risks could impact the next earnings call?
Answering these questions required ETL pipelines, manual dashboards, and delayed reporting. With MindsDB, you can now build AI-native, zero-ETL analytics that query this data directly—powered by Knowledge Bases, Hybrid Search, and Agents.
The Challenge
In many organizations, financial data lives across disconnected systems:
Sales and deal data in Salesforce Opportunities
Contract and delivery data in Orders and Shipments
Billing and payments in Invoices
Consolidated revenue in Financial Statements
This fragmentation creates revenue recognition risk, audit gaps, and delayed reporting, especially when:
Orders are fulfilled before contracts (POs) are signed.
Invoices are partially paid or overdue.
Revenue appears in financial reports without matching delivery evidence.
Traditional ETL workflows are slow and error-prone, making real-time reporting and compliance impossible.

The MindsDB Advantage: Real-Time, Explainable AI for Finance Teams
MindsDB transforms how finance teams access, analyze, and trust their data — eliminating the need for manual aggregation, spreadsheets, and disconnected systems.
Unified, Zero-ETL Access to All Financial Data:
MindsDB connects directly to your existing systems — Salesforce, ERP, CRM, spreadsheets, and financial databases — without the need for ETL. This means your Opportunities, Orders, Invoices, Shipments, and Financial Statements can be analyzed together, privately and securely, without moving data out of its source. All unified by MindsDB’s Knowledge Bases.
Ask Complex Questions in SQL or Plain English — Privately and Securely:
Ask complex financial questions in SQL and natural language and get accurate, evidence-backed answers in seconds. Instead of manually combining spreadsheets or exporting CSVs, MindsDB’s Hybrid Search and AI Agents query and reason across your data — ensuring every response is grounded in real numbers and systems you already trust.
The Result: Faster, Smarter, and More Trustworthy Financial Operations
With MindsDB, finance teams gain a single, AI-native layer that unifies data access, reasoning, and compliance:
Financial reporting and audit checks across systems
Eliminate ETL and manual spreadsheet aggregation
Achieve real-time, explainable insights grounded in verifiable data
Empower teams to focus on decision-making, not data wrangling
In short, for finance teams operating within public B2B companies, MindsDB offers a data-native, AI-first approach: bringing intelligence to your data rather than moving your data to intelligence. The result is faster, reliable, conversational analytics that tie together finance, CRM, logistics and operations into one cohesive view.

Use Case: Real-Time Revenue Validation Across Salesforce and Financial Systems
MindsDB enables finance teams to query, analyze, and validate financial reporting accuracy by connecting operational Salesforce data (CRM, Orders, Invoices, Shipments) directly with official financial statements — without manual reconciliation or ETL.
For this use case, we will explore gaining insights into Salesforce CRM Data and Financial Reports for the fiscal year 2025 from Q1-Q3. We will connect this data to MindsDB, unify it using MindsDB Knowledge Bases, query it using Hybrid Search and Agents.
Pre-requisites:
Access MindsDB’s GUI via Docker locally or MindsDB’s extension on Docker Desktop.
Configure your default models in the MindsDB GUI by navigating to Settings → Models.
MindsDB’s Federated query engine allows you to connect directly to Salesforce using SQL. The CREATE DATABASE statement will be used:
CREATE DATABASE salesforce_datasource WITH ENGINE = 'salesforce', PARAMETERS = { "username": "chandre-bsbv@force.com", "password": "xxxx", "client_id": "3MVG9SiMaxxxxxx", "client_secret": "047CE0DB7AB8834FBxxxxxx" };
A database connection to PGVector will be created to use as storage for the Knowledge Base embeddings:
CREATE DATABASE heroku WITH ENGINE = 'pgvector', PARAMETERS = { "host": "127.0.0.1", "port": 5432, "database": "postgres", "user": "user", "password": "password", "distance": "cosine" };
For the sake of this tutorial, we have uploaded the Financial Report 2025 dataset as a file. You can check out how to Upload Files in our GUI here.
Unifying Your Data By Building Knowledge Bases
You can unify your data using MindsDB Knowledge Bases. A Knowledge Base in MindsDB is an AI-powered table that understands data by meaning, not just keywords — combining embeddings, reranking models, and vector stores for context-aware retrieval.
It enables semantic reasoning across multiple data sources, providing deeper, more accurate insights for intelligent data access. Here we will create Knowledge Bases for our Shipments, Invoices, Orders and Opportunities Salesforce CRM tables, as well as the Financial Report 2025 Spreadsheet.
Start with creating the knowledge base using the CREATE KNOWLEDGE_BASE statement:
CREATE KNOWLEDGE_BASE orders_kb USING storage = heroku.orders, metadata_columns = ['account number', 'activated by', 'activated byt', 'activated date', 'company authorized by', 'company authorized date', 'contract end date', 'contract number', 'contract name', 'contract end date', 'billingaddress', 'created by', 'currency', 'customer authorized by', 'customer authorized date', 'last modified by', 'opportunity', 'order amount', 'order end date', 'order name', 'order number', 'order record type','order reference number', 'order start date', 'order type', 'owner', 'PO date', 'PO number', 'quote', 'reduction order', 'shipping city', 'shipping country', 'shipping street', 'ship to contact' ], content_columns = ['description', 'status'], id_column = 'account name';
Here are the parameters provided:
orders_kb: The name of the knowledge base.storage: The storage table where the embeddings of the knowledge base is stored. As you can see we are using the pgvector database we created a connection with and provide the nameordersto the table that will be created for storage.metadata_columns: Here columns are provided as meta data columns to perform metadata filtering.content_columns: Here columns are provided for semantic search.id_column: This uniquely identifies each source data row in the knowledge base.
We can Insert the data using the INSERT INTO statement:
INSERT INTO orders_kb SELECT `account number` as 'account number', `activated by` as 'activated by', `activated date` as 'activated date', `company authorized by` as 'company authorized by', `company authorized date` as 'company authorized date', `contract end date` as 'contract end date', `contract number` as 'contract number', `contract name` as 'contract name', `contract end date` as 'contract end date', `created by` as 'created by', currency, `customer authorized by` as 'customer authorized by', `customer authorized date` as 'customer authorized date', `last modified by` as 'last modified by', opportunity, `order amount` as 'order amount', `order end date` as 'order end date', `order name` as 'rder name', `order number` as 'order number', `order record type` as 'order record type',`order reference number` as 'order reference number`', `order start date` as 'order start date', `order type` as 'order type', owner, `PO date` as 'PO date', `PO number` as 'PO number', quote, `reduction order` as 'reduction order', `shipping city` as 'shipping city', `shipping country` as 'shipping country', `shipping street` as 'shipping street', `ship to contact` as 'ship to contact', description, status, `account name` as 'account name' FROM salesforce_datasource.orders;
We can query the Knowledge Base using the SELECT statement:
SELECT * FROM orders_kb;

The same can be done for the Financial Report:
-- Create Knowledge Base CREATE KNOWLEDGE_BASE financial_report2025 USING storage = heroku.financial_report, metadata_columns = ['net_revenue_millions', 'operating_income_millions', 'net_income_millions', 'operating_margin_percent', 'net_margin_percent', 'earnings_per_share', 'expenses_millions', 'r_and_d_expenses_millions', 'sales_and_marketing_expenses_millions', 'general_and_admin_expenses_millions', 'cash_flow_operations_millions', 'total_assets_millions', 'total_liabilities_millions', 'shareholders_equity_millions'], content_columns = ['month_name'], id_column = 'quarter'; --Insert Into Knowledge Base INSERT INTO financial_report2025 SELECT net_revenue_millions, operating_income_millions, net_income_millions, operating_margin_percent, net_margin_percent, earnings_per_share, expenses_millions, r_and_d_expenses_millions, sales_and_marketing_expenses_millions, general_and_admin_expenses_millions, cash_flow_operations_millions, total_assets_millions, total_liabilities_millions, shareholders_equity_millions, month_name, quarter FROM files.financial_report_2025; --Select Knowledge Base SELECT * FROM financial_report2025;

The following Knowledge Bases were also created using the above steps:
Shipments_kb :contains shipment data hosted in Salesforce.

invoices_kb: contains invoice details hosted in Salesforce.

opportunities_kb: contains opportunities data hosted in Salesforce.

Hybrid Search for Finance: Bridging Operational Data and Financial Reporting with AI
MindsDB’s Hybrid Search lets you combine semantic and structured filters for deeper insights.
Lets identify overdue invoices tied to key accounts that might affect cash flow or require write-offs.
-- Detect Invoices with Long Outstanding Balances SELECT * FROM invoices_kb WHERE hybrid_search = TRUE AND hybrid_search_alpha >= 0.5 AND content = 'payment delays or pending collection' AND `days outstanding` > 45;
This helps finance teams flag overdue receivables, especially important for SOX Section 404 compliance and aging report validation.

Lets try to correlate Orders and Invoices for Revenue Reconciliation to Ensure every billed order is represented as a recorded invoice, and verify consistency between order_amount and impact_amount.
-- Correlate Orders and Invoices for Revenue Reconciliation SELECT * FROM orders_kb JOIN invoices_kb ON orders_kb.id = invoices_kb.id WHERE orders_kb.hybrid_search = TRUE AND invoices_kb.hybrid_search = TRUE AND orders_kb.hybrid_search_alpha >= 0.5 AND invoices_kb.hybrid_search_alpha >= 0.5 AND orders_kb.content = 'order fulfillment completed' AND invoices_kb.content = 'invoice posted and awaiting payment';
We can see customers like Acme Corp 12 and Finserve partners have activated fulfilled orders.

And that their orders are Partially paid or the Invoice is locked due to the payment method being mismatched and it requires action. This supports audit traceability from “Order → Invoice → Payment,” ensuring recognized revenue matches delivery obligations

You can validate if forecasted opportunities have corresponding orders within the same quarter — key for forecast reliability.
-- Cross-Join Opportunities and Orders for Forecast Accuracy SELECT * FROM opportunities_kb JOIN orders_kb ON opportunities_kb.id = orders_kb.id WHERE opportunities_kb.hybrid_search = TRUE AND orders_kb.hybrid_search = TRUE AND opportunities_kb.hybrid_search_alpha >= 0.5 AND orders_kb.hybrid_search_alpha >= 0.5 AND opportunities_kb.content = 'enterprise expansion opportunity' AND orders_kb.content = 'active or pending fulfillment' AND opportunities_kb.forecast_category IN ('Commit', 'Best Case');
This helps financial controllers confirm that pipeline forecasts are grounded in real order creation, improving rolling forecast accuracy and budget variance analysis.
We can identify customers like Smart Corp and Acme Corp have an expansion to Enterprise tier Opportunity.

And they have active orders that are partially fulfilled.

We can create a full end-to-end trace from CRM opportunity → booked order → issued invoice and identify accounts where the revenue chain is incomplete.
--Compliance Audit Trail Across All Three — Opportunities, Orders & Invoices SELECT * FROM opportunities_kb JOIN orders_kb ON opportunities_kb.id = orders_kb.id JOIN invoices_kb ON opportunities_kb.id = invoices_kb.id WHERE opportunities_kb.hybrid_search = TRUE AND orders_kb.hybrid_search = TRUE AND invoices_kb.hybrid_search = TRUE AND opportunities_kb.hybrid_search_alpha >= 0.5 AND orders_kb.hybrid_search_alpha >= 0.5 AND invoices_kb.hybrid_search_alpha >= 0.5 AND opportunities_kb.content = 'PO awaiting signature' AND orders_kb.content = 'activated fulfilled, partially fulfilled' AND invoices_kb.content = 'partially paid';
There has been orders which have been partially fulfilled. A control gap exists when fulfillment starts before contract or payment completion, creating risks of premature revenue and misstated receivables.

The order is also partially invoiced.Overstated pipeline and delayed payments distort forecasts and increase collection risk, requiring potential reserve adjustments.

Obtain Insights From CRM Data and Financial Statements In Natural Language Using MindsDB Agents
By creating a MindsDB Agent connected to multiple Knowledge Bases, finance teams gain a single, intelligent interface to ask natural language questions about the entire revenue cycle.
The agent can be created by using the CREATE AGENT statement:
CREATE AGENT financial_reporting_agent USING data = { "knowledge_bases": ['shipments_kb', 'orders_kb', 'invoices_kb', 'opportunities_kb', 'financial_report2025'] }, prompt_template = " You are a Financial Data Analysis Agent connected to Salesforce and finance datasets stored in MindsDB Knowledge Bases. Your purpose is to help finance, compliance, and audit teams analyze and interpret data across: - `shipments_kb` → shipment and logistics data - `orders_kb` → Salesforce order and fulfillment data - `invoices_kb` → Salesforce invoices and payment data - `opportunities_kb` → Salesforce CRM pipeline and deal data - `financial_report2025` → official financial statements for fiscal year 2025 (Q1 till Q3) ### Your Reasoning Context 1. **Date and Quarter Understanding** - All datasets use date formats in `YYYY-MM-DD` (e.g., 2025-09-29). - You can parse and interpret these dates to determine the correct month and quarter. - Map months to quarters as follows: - Q1 = January (01), February (02), March (03) - Q2 = April (04), May (05), June (06) - Q3 = July (07), August (08), September (09) - Q4 = October (10), November (11), December (12) - Fiscal Year 2025 = January 2025 to December 2025. - Understand temporal phrases such as: - “This quarter” → the current quarter in 2025 based on the date field. - “Last quarter” → the quarter immediately before the current quarter. - “Year-to-date (YTD)” → all months from January up to the current month in 2025. - “Previous month” → the month before the most recent date in the dataset. 2. **Revenue recognition context** - Revenue can only be recognized once a contract is enforceable (PO signed) and performance obligations are fulfilled (order delivered or service rendered). - Closed-won opportunities indicate potential revenue, but only fulfilled and invoiced orders should be recognized in financial statements. - Partially fulfilled or partially paid orders indicate deferred or unrecognized revenue. 3. **Compliance and audit understanding** - Identify mismatches between CRM, billing, and financial statements. - Highlight potential risks like premature revenue, unsigned contracts, or overdue invoices. 4. **Analytical objectives** - Reconcile Salesforce opportunities, orders, and invoices with financial statements. - Summarize revenue performance, outstanding balances, and fulfillment progress per quarter. - Detect control exceptions, data gaps, and compliance risks. - Respond to natural language queries about contracts, invoices, orders, payments, shipments, or quarterly financial performance. - When users ask about a specific quarter or month, filter data by the date fields. - Example: For Q3 2025, include all records from 2025-07-01 to 2025-09-30. - When comparing across time, use these date ranges to calculate quarterly or monthly aggregates. - If users ask “Compare Q2 and Q3 2025 revenue,” calculate totals based on these date filters. ### Output Style - Clearly reference time periods (month, quarter, or fiscal year) when summarizing data. - Provide both narrative and tabular summaries if multiple time periods are compared. - Always ground insights in date-based logic derived from the dataset fields. Always ground responses in data retrieved from the provided Knowledge Bases and interpret time periods accurately based on quarterly definitions. ";
Here is the breakdown of the parameters provided to the agent:
financial_reporting_agent: The name provided to the agentdata: This parameter stores data connected to the agent, including knowledge bases and data sources connected to MindsDB.Knowledge_bases: stores the list of knowledge bases to be used by the agent.Prompt_template: This parameter stores instructions for the agent. It is recommended to provide data description of the data sources listed in theknowledge_basesparameter to help the agent locate relevant data for answering questions.
MindsDB’s GUI offers a Chat Interface that allows you to chat with your agent and query your data using natural language. To start, make sure the correct agent is selected in the Agent’s tab.
Let's ask the agent multi-layered, compliance-aware finance questions in plain English that blend operational and financial data.
1.Revenue Recognition & Contract Compliance
Question 1: What revenue in Q3 2025 could be overstated due to uncollected or unsigned contracts?

2.Forecasting, Cash Flow & Risk Analysis
Question 1: Forecast expected cash inflow from all partially paid invoices.

Question 2: Which accounts pose the highest risk to quarterly revenue due to incomplete payments or unsigned POs?

3.Insight / Executive Summary Prompts
Question 1: Summarize the overall health of our revenue recognition process for FY2025.

The agent further provides key observations:

Question 2: Provide a summary of Q3 2025 revenue risks and outstanding invoices.

Here is the Summary Table:

4.Financial Statement Reconciliation
Question 1: Reconciled the total ‘Closed Won’ opportunity amounts with the net revenue reported in Q2 2025

Question 2: Which business units have the most incomplete revenue cycles?

Question 3: How do the balances of unpaid invoices compare with the receivables in the financial report for Q3 2025?


Further analysis:

Question 3: List discrepancies between revenue recognized in the financial report and billed amounts in invoices.


Not only did the agent provide an analysis of discrepancies, it also identified a possible data gap or delay in invoicing.
The Outcome: Audit-Ready Intelligence in Real Time
With MindsDB, finance teams can:
Perform financial reporting, reconciliation, and variance analysis
Gain end-to-end visibility across CRM → Orders → Invoices → Reports
Detect compliance gaps before audits
Deliver trustworthy, explainable insights without ETL
MindsDB turns enterprise finance data into a live, conversational, and compliant analytics layer — where every answer is backed by data, traceable, and ready for the boardroom.
Why It Matters
Finance leaders are under growing pressure to deliver accurate, real-time insights while staying compliant with ASC 606, IFRS 15, and SOX requirements. Yet, fragmented systems, manual reconciliations, and spreadsheet-driven workflows slow everything down — increasing audit risk and delaying decisions.
MindsDB changes that.
By unifying financial data from Salesforce, ERP, and reporting systems into a zero-ETL, AI-native layer, MindsDB allows teams to:
Validate revenue recognition before audits catch discrepancies.
Trace every financial insight to source data — improving audit readiness.
Detect control gaps early, such as uncollected invoices or unsigned contracts.
Deliver faster board reporting with transparent, explainable analytics.
In short, this matters because finance no longer has to choose between speed, accuracy, and compliance. MindsDB gives teams all three — in real time, with full transparency.

Conclusion
Financial data moves faster than traditional systems can handle, MindsDB gives finance teams the power to stay ahead — unifying fragmented data into a single, intelligent layer for real-time analysis. By connecting Salesforce, ERP, and reporting systems without ETL, MindsDB turns complexity into clarity, helping teams detect risks, validate revenue, and build confidence in every number they report.
MindsDB offers Minds Enterprise solution, making Enterprise data Intelligent and Responsive with AI. Powered by the Cognitive Engine, Knowledge Base, and Federated Query Engine, it transforms raw data into actionable insights. Build AI Search, Analytics, and Agents seamlessly—all from one solution. Contact our team to see Minds in action.
Whether it’s preparing for the next audit, presenting to the board, or ensuring compliance, MindsDB equips finance teams with real-time, explainable, and trustworthy insights — all backed by their own data.
Build the future of financial intelligence — with MindsDB.
Finance teams are expected to deliver real-time, audit-ready insights — but their data still lives across disconnected systems like Salesforce, ERP, and spreadsheets. This creates delays, compliance risks, and manual effort in reporting and reconciliation. MindsDB solves this by unifying all financial data in place — no ETL, no copying — through AI-native Knowledge Bases, Hybrid Search, and Agents. The result: a single, explainable layer for querying invoices, orders, opportunities, and financial reports in real time. Finance leaders can now ask natural questions, trace every answer to source data, and ensure decisions are both accurate and compliant — all from one secure, intelligent platform.
Finance teams at publicly traded B2B companies juggle dozens of systems—from financial reports and CRM dashboards to invoices, shipments, and contracts.
Each tells part of the story, but the real insight lies across them:
How does revenue growth relate to delayed shipments or unpaid invoices?
Which large enterprise accounts contribute most to quarterly performance?
What risks could impact the next earnings call?
Answering these questions required ETL pipelines, manual dashboards, and delayed reporting. With MindsDB, you can now build AI-native, zero-ETL analytics that query this data directly—powered by Knowledge Bases, Hybrid Search, and Agents.
The Challenge
In many organizations, financial data lives across disconnected systems:
Sales and deal data in Salesforce Opportunities
Contract and delivery data in Orders and Shipments
Billing and payments in Invoices
Consolidated revenue in Financial Statements
This fragmentation creates revenue recognition risk, audit gaps, and delayed reporting, especially when:
Orders are fulfilled before contracts (POs) are signed.
Invoices are partially paid or overdue.
Revenue appears in financial reports without matching delivery evidence.
Traditional ETL workflows are slow and error-prone, making real-time reporting and compliance impossible.

The MindsDB Advantage: Real-Time, Explainable AI for Finance Teams
MindsDB transforms how finance teams access, analyze, and trust their data — eliminating the need for manual aggregation, spreadsheets, and disconnected systems.
Unified, Zero-ETL Access to All Financial Data:
MindsDB connects directly to your existing systems — Salesforce, ERP, CRM, spreadsheets, and financial databases — without the need for ETL. This means your Opportunities, Orders, Invoices, Shipments, and Financial Statements can be analyzed together, privately and securely, without moving data out of its source. All unified by MindsDB’s Knowledge Bases.
Ask Complex Questions in SQL or Plain English — Privately and Securely:
Ask complex financial questions in SQL and natural language and get accurate, evidence-backed answers in seconds. Instead of manually combining spreadsheets or exporting CSVs, MindsDB’s Hybrid Search and AI Agents query and reason across your data — ensuring every response is grounded in real numbers and systems you already trust.
The Result: Faster, Smarter, and More Trustworthy Financial Operations
With MindsDB, finance teams gain a single, AI-native layer that unifies data access, reasoning, and compliance:
Financial reporting and audit checks across systems
Eliminate ETL and manual spreadsheet aggregation
Achieve real-time, explainable insights grounded in verifiable data
Empower teams to focus on decision-making, not data wrangling
In short, for finance teams operating within public B2B companies, MindsDB offers a data-native, AI-first approach: bringing intelligence to your data rather than moving your data to intelligence. The result is faster, reliable, conversational analytics that tie together finance, CRM, logistics and operations into one cohesive view.

Use Case: Real-Time Revenue Validation Across Salesforce and Financial Systems
MindsDB enables finance teams to query, analyze, and validate financial reporting accuracy by connecting operational Salesforce data (CRM, Orders, Invoices, Shipments) directly with official financial statements — without manual reconciliation or ETL.
For this use case, we will explore gaining insights into Salesforce CRM Data and Financial Reports for the fiscal year 2025 from Q1-Q3. We will connect this data to MindsDB, unify it using MindsDB Knowledge Bases, query it using Hybrid Search and Agents.
Pre-requisites:
Access MindsDB’s GUI via Docker locally or MindsDB’s extension on Docker Desktop.
Configure your default models in the MindsDB GUI by navigating to Settings → Models.
MindsDB’s Federated query engine allows you to connect directly to Salesforce using SQL. The CREATE DATABASE statement will be used:
CREATE DATABASE salesforce_datasource WITH ENGINE = 'salesforce', PARAMETERS = { "username": "chandre-bsbv@force.com", "password": "xxxx", "client_id": "3MVG9SiMaxxxxxx", "client_secret": "047CE0DB7AB8834FBxxxxxx" };
A database connection to PGVector will be created to use as storage for the Knowledge Base embeddings:
CREATE DATABASE heroku WITH ENGINE = 'pgvector', PARAMETERS = { "host": "127.0.0.1", "port": 5432, "database": "postgres", "user": "user", "password": "password", "distance": "cosine" };
For the sake of this tutorial, we have uploaded the Financial Report 2025 dataset as a file. You can check out how to Upload Files in our GUI here.
Unifying Your Data By Building Knowledge Bases
You can unify your data using MindsDB Knowledge Bases. A Knowledge Base in MindsDB is an AI-powered table that understands data by meaning, not just keywords — combining embeddings, reranking models, and vector stores for context-aware retrieval.
It enables semantic reasoning across multiple data sources, providing deeper, more accurate insights for intelligent data access. Here we will create Knowledge Bases for our Shipments, Invoices, Orders and Opportunities Salesforce CRM tables, as well as the Financial Report 2025 Spreadsheet.
Start with creating the knowledge base using the CREATE KNOWLEDGE_BASE statement:
CREATE KNOWLEDGE_BASE orders_kb USING storage = heroku.orders, metadata_columns = ['account number', 'activated by', 'activated byt', 'activated date', 'company authorized by', 'company authorized date', 'contract end date', 'contract number', 'contract name', 'contract end date', 'billingaddress', 'created by', 'currency', 'customer authorized by', 'customer authorized date', 'last modified by', 'opportunity', 'order amount', 'order end date', 'order name', 'order number', 'order record type','order reference number', 'order start date', 'order type', 'owner', 'PO date', 'PO number', 'quote', 'reduction order', 'shipping city', 'shipping country', 'shipping street', 'ship to contact' ], content_columns = ['description', 'status'], id_column = 'account name';
Here are the parameters provided:
orders_kb: The name of the knowledge base.storage: The storage table where the embeddings of the knowledge base is stored. As you can see we are using the pgvector database we created a connection with and provide the nameordersto the table that will be created for storage.metadata_columns: Here columns are provided as meta data columns to perform metadata filtering.content_columns: Here columns are provided for semantic search.id_column: This uniquely identifies each source data row in the knowledge base.
We can Insert the data using the INSERT INTO statement:
INSERT INTO orders_kb SELECT `account number` as 'account number', `activated by` as 'activated by', `activated date` as 'activated date', `company authorized by` as 'company authorized by', `company authorized date` as 'company authorized date', `contract end date` as 'contract end date', `contract number` as 'contract number', `contract name` as 'contract name', `contract end date` as 'contract end date', `created by` as 'created by', currency, `customer authorized by` as 'customer authorized by', `customer authorized date` as 'customer authorized date', `last modified by` as 'last modified by', opportunity, `order amount` as 'order amount', `order end date` as 'order end date', `order name` as 'rder name', `order number` as 'order number', `order record type` as 'order record type',`order reference number` as 'order reference number`', `order start date` as 'order start date', `order type` as 'order type', owner, `PO date` as 'PO date', `PO number` as 'PO number', quote, `reduction order` as 'reduction order', `shipping city` as 'shipping city', `shipping country` as 'shipping country', `shipping street` as 'shipping street', `ship to contact` as 'ship to contact', description, status, `account name` as 'account name' FROM salesforce_datasource.orders;
We can query the Knowledge Base using the SELECT statement:
SELECT * FROM orders_kb;

The same can be done for the Financial Report:
-- Create Knowledge Base CREATE KNOWLEDGE_BASE financial_report2025 USING storage = heroku.financial_report, metadata_columns = ['net_revenue_millions', 'operating_income_millions', 'net_income_millions', 'operating_margin_percent', 'net_margin_percent', 'earnings_per_share', 'expenses_millions', 'r_and_d_expenses_millions', 'sales_and_marketing_expenses_millions', 'general_and_admin_expenses_millions', 'cash_flow_operations_millions', 'total_assets_millions', 'total_liabilities_millions', 'shareholders_equity_millions'], content_columns = ['month_name'], id_column = 'quarter'; --Insert Into Knowledge Base INSERT INTO financial_report2025 SELECT net_revenue_millions, operating_income_millions, net_income_millions, operating_margin_percent, net_margin_percent, earnings_per_share, expenses_millions, r_and_d_expenses_millions, sales_and_marketing_expenses_millions, general_and_admin_expenses_millions, cash_flow_operations_millions, total_assets_millions, total_liabilities_millions, shareholders_equity_millions, month_name, quarter FROM files.financial_report_2025; --Select Knowledge Base SELECT * FROM financial_report2025;

The following Knowledge Bases were also created using the above steps:
Shipments_kb :contains shipment data hosted in Salesforce.

invoices_kb: contains invoice details hosted in Salesforce.

opportunities_kb: contains opportunities data hosted in Salesforce.

Hybrid Search for Finance: Bridging Operational Data and Financial Reporting with AI
MindsDB’s Hybrid Search lets you combine semantic and structured filters for deeper insights.
Lets identify overdue invoices tied to key accounts that might affect cash flow or require write-offs.
-- Detect Invoices with Long Outstanding Balances SELECT * FROM invoices_kb WHERE hybrid_search = TRUE AND hybrid_search_alpha >= 0.5 AND content = 'payment delays or pending collection' AND `days outstanding` > 45;
This helps finance teams flag overdue receivables, especially important for SOX Section 404 compliance and aging report validation.

Lets try to correlate Orders and Invoices for Revenue Reconciliation to Ensure every billed order is represented as a recorded invoice, and verify consistency between order_amount and impact_amount.
-- Correlate Orders and Invoices for Revenue Reconciliation SELECT * FROM orders_kb JOIN invoices_kb ON orders_kb.id = invoices_kb.id WHERE orders_kb.hybrid_search = TRUE AND invoices_kb.hybrid_search = TRUE AND orders_kb.hybrid_search_alpha >= 0.5 AND invoices_kb.hybrid_search_alpha >= 0.5 AND orders_kb.content = 'order fulfillment completed' AND invoices_kb.content = 'invoice posted and awaiting payment';
We can see customers like Acme Corp 12 and Finserve partners have activated fulfilled orders.

And that their orders are Partially paid or the Invoice is locked due to the payment method being mismatched and it requires action. This supports audit traceability from “Order → Invoice → Payment,” ensuring recognized revenue matches delivery obligations

You can validate if forecasted opportunities have corresponding orders within the same quarter — key for forecast reliability.
-- Cross-Join Opportunities and Orders for Forecast Accuracy SELECT * FROM opportunities_kb JOIN orders_kb ON opportunities_kb.id = orders_kb.id WHERE opportunities_kb.hybrid_search = TRUE AND orders_kb.hybrid_search = TRUE AND opportunities_kb.hybrid_search_alpha >= 0.5 AND orders_kb.hybrid_search_alpha >= 0.5 AND opportunities_kb.content = 'enterprise expansion opportunity' AND orders_kb.content = 'active or pending fulfillment' AND opportunities_kb.forecast_category IN ('Commit', 'Best Case');
This helps financial controllers confirm that pipeline forecasts are grounded in real order creation, improving rolling forecast accuracy and budget variance analysis.
We can identify customers like Smart Corp and Acme Corp have an expansion to Enterprise tier Opportunity.

And they have active orders that are partially fulfilled.

We can create a full end-to-end trace from CRM opportunity → booked order → issued invoice and identify accounts where the revenue chain is incomplete.
--Compliance Audit Trail Across All Three — Opportunities, Orders & Invoices SELECT * FROM opportunities_kb JOIN orders_kb ON opportunities_kb.id = orders_kb.id JOIN invoices_kb ON opportunities_kb.id = invoices_kb.id WHERE opportunities_kb.hybrid_search = TRUE AND orders_kb.hybrid_search = TRUE AND invoices_kb.hybrid_search = TRUE AND opportunities_kb.hybrid_search_alpha >= 0.5 AND orders_kb.hybrid_search_alpha >= 0.5 AND invoices_kb.hybrid_search_alpha >= 0.5 AND opportunities_kb.content = 'PO awaiting signature' AND orders_kb.content = 'activated fulfilled, partially fulfilled' AND invoices_kb.content = 'partially paid';
There has been orders which have been partially fulfilled. A control gap exists when fulfillment starts before contract or payment completion, creating risks of premature revenue and misstated receivables.

The order is also partially invoiced.Overstated pipeline and delayed payments distort forecasts and increase collection risk, requiring potential reserve adjustments.

Obtain Insights From CRM Data and Financial Statements In Natural Language Using MindsDB Agents
By creating a MindsDB Agent connected to multiple Knowledge Bases, finance teams gain a single, intelligent interface to ask natural language questions about the entire revenue cycle.
The agent can be created by using the CREATE AGENT statement:
CREATE AGENT financial_reporting_agent USING data = { "knowledge_bases": ['shipments_kb', 'orders_kb', 'invoices_kb', 'opportunities_kb', 'financial_report2025'] }, prompt_template = " You are a Financial Data Analysis Agent connected to Salesforce and finance datasets stored in MindsDB Knowledge Bases. Your purpose is to help finance, compliance, and audit teams analyze and interpret data across: - `shipments_kb` → shipment and logistics data - `orders_kb` → Salesforce order and fulfillment data - `invoices_kb` → Salesforce invoices and payment data - `opportunities_kb` → Salesforce CRM pipeline and deal data - `financial_report2025` → official financial statements for fiscal year 2025 (Q1 till Q3) ### Your Reasoning Context 1. **Date and Quarter Understanding** - All datasets use date formats in `YYYY-MM-DD` (e.g., 2025-09-29). - You can parse and interpret these dates to determine the correct month and quarter. - Map months to quarters as follows: - Q1 = January (01), February (02), March (03) - Q2 = April (04), May (05), June (06) - Q3 = July (07), August (08), September (09) - Q4 = October (10), November (11), December (12) - Fiscal Year 2025 = January 2025 to December 2025. - Understand temporal phrases such as: - “This quarter” → the current quarter in 2025 based on the date field. - “Last quarter” → the quarter immediately before the current quarter. - “Year-to-date (YTD)” → all months from January up to the current month in 2025. - “Previous month” → the month before the most recent date in the dataset. 2. **Revenue recognition context** - Revenue can only be recognized once a contract is enforceable (PO signed) and performance obligations are fulfilled (order delivered or service rendered). - Closed-won opportunities indicate potential revenue, but only fulfilled and invoiced orders should be recognized in financial statements. - Partially fulfilled or partially paid orders indicate deferred or unrecognized revenue. 3. **Compliance and audit understanding** - Identify mismatches between CRM, billing, and financial statements. - Highlight potential risks like premature revenue, unsigned contracts, or overdue invoices. 4. **Analytical objectives** - Reconcile Salesforce opportunities, orders, and invoices with financial statements. - Summarize revenue performance, outstanding balances, and fulfillment progress per quarter. - Detect control exceptions, data gaps, and compliance risks. - Respond to natural language queries about contracts, invoices, orders, payments, shipments, or quarterly financial performance. - When users ask about a specific quarter or month, filter data by the date fields. - Example: For Q3 2025, include all records from 2025-07-01 to 2025-09-30. - When comparing across time, use these date ranges to calculate quarterly or monthly aggregates. - If users ask “Compare Q2 and Q3 2025 revenue,” calculate totals based on these date filters. ### Output Style - Clearly reference time periods (month, quarter, or fiscal year) when summarizing data. - Provide both narrative and tabular summaries if multiple time periods are compared. - Always ground insights in date-based logic derived from the dataset fields. Always ground responses in data retrieved from the provided Knowledge Bases and interpret time periods accurately based on quarterly definitions. ";
Here is the breakdown of the parameters provided to the agent:
financial_reporting_agent: The name provided to the agentdata: This parameter stores data connected to the agent, including knowledge bases and data sources connected to MindsDB.Knowledge_bases: stores the list of knowledge bases to be used by the agent.Prompt_template: This parameter stores instructions for the agent. It is recommended to provide data description of the data sources listed in theknowledge_basesparameter to help the agent locate relevant data for answering questions.
MindsDB’s GUI offers a Chat Interface that allows you to chat with your agent and query your data using natural language. To start, make sure the correct agent is selected in the Agent’s tab.
Let's ask the agent multi-layered, compliance-aware finance questions in plain English that blend operational and financial data.
1.Revenue Recognition & Contract Compliance
Question 1: What revenue in Q3 2025 could be overstated due to uncollected or unsigned contracts?

2.Forecasting, Cash Flow & Risk Analysis
Question 1: Forecast expected cash inflow from all partially paid invoices.

Question 2: Which accounts pose the highest risk to quarterly revenue due to incomplete payments or unsigned POs?

3.Insight / Executive Summary Prompts
Question 1: Summarize the overall health of our revenue recognition process for FY2025.

The agent further provides key observations:

Question 2: Provide a summary of Q3 2025 revenue risks and outstanding invoices.

Here is the Summary Table:

4.Financial Statement Reconciliation
Question 1: Reconciled the total ‘Closed Won’ opportunity amounts with the net revenue reported in Q2 2025

Question 2: Which business units have the most incomplete revenue cycles?

Question 3: How do the balances of unpaid invoices compare with the receivables in the financial report for Q3 2025?


Further analysis:

Question 3: List discrepancies between revenue recognized in the financial report and billed amounts in invoices.


Not only did the agent provide an analysis of discrepancies, it also identified a possible data gap or delay in invoicing.
The Outcome: Audit-Ready Intelligence in Real Time
With MindsDB, finance teams can:
Perform financial reporting, reconciliation, and variance analysis
Gain end-to-end visibility across CRM → Orders → Invoices → Reports
Detect compliance gaps before audits
Deliver trustworthy, explainable insights without ETL
MindsDB turns enterprise finance data into a live, conversational, and compliant analytics layer — where every answer is backed by data, traceable, and ready for the boardroom.
Why It Matters
Finance leaders are under growing pressure to deliver accurate, real-time insights while staying compliant with ASC 606, IFRS 15, and SOX requirements. Yet, fragmented systems, manual reconciliations, and spreadsheet-driven workflows slow everything down — increasing audit risk and delaying decisions.
MindsDB changes that.
By unifying financial data from Salesforce, ERP, and reporting systems into a zero-ETL, AI-native layer, MindsDB allows teams to:
Validate revenue recognition before audits catch discrepancies.
Trace every financial insight to source data — improving audit readiness.
Detect control gaps early, such as uncollected invoices or unsigned contracts.
Deliver faster board reporting with transparent, explainable analytics.
In short, this matters because finance no longer has to choose between speed, accuracy, and compliance. MindsDB gives teams all three — in real time, with full transparency.

Conclusion
Financial data moves faster than traditional systems can handle, MindsDB gives finance teams the power to stay ahead — unifying fragmented data into a single, intelligent layer for real-time analysis. By connecting Salesforce, ERP, and reporting systems without ETL, MindsDB turns complexity into clarity, helping teams detect risks, validate revenue, and build confidence in every number they report.
MindsDB offers Minds Enterprise solution, making Enterprise data Intelligent and Responsive with AI. Powered by the Cognitive Engine, Knowledge Base, and Federated Query Engine, it transforms raw data into actionable insights. Build AI Search, Analytics, and Agents seamlessly—all from one solution. Contact our team to see Minds in action.
Whether it’s preparing for the next audit, presenting to the board, or ensuring compliance, MindsDB equips finance teams with real-time, explainable, and trustworthy insights — all backed by their own data.
Build the future of financial intelligence — with MindsDB.
Start Building with MindsDB Today
Power your AI strategy with the leading AI data solution.
© 2025 All rights reserved by MindsDB.
Start Building with MindsDB Today
Power your AI strategy with the leading AI data solution.
© 2025 All rights reserved by MindsDB.
Start Building with MindsDB Today
Power your AI strategy with the leading AI data solution.
© 2025 All rights reserved by MindsDB.
Start Building with MindsDB Today
Power your AI strategy with the leading AI data solution.
© 2025 All rights reserved by MindsDB.