Intelligence models
Reference for the Intelligence semantic model used in the Sovos Intelligence Query Builder.
What this domain is
Models in scope: one (INVOICES).
The Intelligence INVOICES model is a deliberately thin, unified invoice feed that stacks records from multiple upstream domains (SAF-T sales, SAF-T purchases, and VAT Filing transactions) into one consistent set of columns. Use it for quick cross-source, portfolio-level roll-ups (total invoices, net/gross, counts by country or company) when you don't need domain-specific detail.
Grain and composition
INVOICES is a UNION ALL of three sources, distinguished by SourceDomain. Because the VAT-Filing branch is transaction-line-grained while the SAF-T branches are invoice-grained, the grain is mixed by SourceDomain, a critical caveat when aggregating (see the practical notes below). CompanyId is the cross-domain join key back to CN, VAT, and SAF-T.
Practical notes for Intelligence
- The VAT-sourced rows carry the
SourceDomainvalueVAT Filling, a literal misspelling in the source SQL (two L's). Filter on the exact string. - Sales rows populate customer fields (supplier NULL). Purchase rows populate supplier fields (customer NULL).
InvoiceDateis aTIMESTAMP_NTZhere (it isDATEin most other models).- Summing across
SourceDomaincan double-count because of the mixed grain. Aggregate within a single source, or reconcile deliberately.
INVOICES
- Variant name
-
INVOICES. modelName "Intelligence". modelGroupId302972fa-.. Version 1. - Grain
- One row = one invoice record from one of three upstream sources (SAF-T sales, SAF-T purchases, or VAT Filing transaction). The VAT Filing transaction data is line-grained, so VAT-Filing-sourced rows are effectively line-level while SAF-T rows are invoice-level. Grain is mixed by SourceDomain.
- Purpose
- Lowest-common-denominator unified invoice feed across Intelligence data domains for cross-source analytics, with consistent columns (number, date, counterpart, net/gross, company, country) regardless of origin. Only sales-side rows carry customer fields. Only purchase-side rows carry supplier fields.
| Field | Type | Description | Example values / notes |
|---|---|---|---|
| SourceDomain | VARCHAR(11) | Origin of the row. | SAFT (from SAF-T sales and purchases); VAT Filling (note the spelling) |
| InvoiceNumber | VARCHAR(16MB) | Invoice number. | FT 2025/126, NC 2025/3 (NC = credit note) |
| InvoiceDate | TIMESTAMP_NTZ(9) | Invoice date. | 2025-10-14 (note: TIMESTAMP, not DATE) |
| CustomerRegistrationNumber | VARCHAR | Customer tax/registration no. NULL for purchase rows. | 2818798 |
| CustomerName | VARCHAR | Customer name. NULL for purchase rows. | JumpStart Demo Ventures |
| SupplierRegistrationNumber | VARCHAR | Supplier tax/registration no. NULL for sales rows. | |
| SupplierName | VARCHAR | Supplier name. NULL for sales rows. | |
| NetTotal | NUMBER(38,8) | Net amount. SAF-T: NETTOTAL; VAT: COALESCE(TaxableBasisCredit,Debit). | 10000, 2280, 19500 |
| GrossTotal | NUMBER(38,2) | Gross amount. SAF-T: GROSSTOTAL; VAT: TOTALVALUELINE. | 12300, 2804.4, 1800 |
| CompanyId | VARCHAR | SDA_COMPANY_ID, primary cross-domain join key. |
1ff7877a-7337-4d57-8a50-e86be2a154c4 |
| Country | VARCHAR(300) | UPPER(COUNTRY). | RO |
- Keys vs attributes vs measures
-
Keys:
CompanyId(SDA_COMPANY_ID), plusInvoiceNumberas business id. Measures:NetTotal,GrossTotal. Attributes:SourceDomain, dates, counterpart names/numbers,Country. - Joins
-
CompanyId(SDA_COMPANY_ID) links to VAT_INVOICES.CompanyId and CN models' CompanyId, the unifying key across all three domains. No physical joins inside the model (pure UNION ALL). - Notes
-
The
SourceDomainvalue from the VAT branch is the literal misspelling'VAT Filling'(two L's). Filter carefully. Customer vs Supplier columns are mutually exclusive per row (sales rows: supplier NULL; purchase rows: customer NULL). Mixed grain: SAF-T rows are per-invoice, VAT-Filing rows are per-transaction-line, so summing across SourceDomain can double-count.
