> ## Documentation Index
> Fetch the complete documentation index at: https://docs.credibledata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Semantic Model

> Core concepts and components of semantic models in Credible

A semantic layer is a business-friendly abstraction that sits between raw data and analytical applications, translating technical schemas into shared business vocabulary. In Credible, semantic models are built using [Malloy](https://malloydata.dev), creating a governed foundation that ensures consistent definitions across all data consumption patterns.

## Why Semantic Models Matter

Modern organizations have data distributed across many systems—sales data in CRM platforms, marketing data in analytics tools, financial data in ERP systems. Each system often develops its own definitions and calculations for key metrics. A semantic model creates a unified business vocabulary by defining metrics, relationships, and business logic in one place, making it reusable across all data consumption patterns.

The semantic layer acts as a **data contract** between data producers (engineering teams) and consumers (analysts, applications, AI agents). This contract provides semantic stability—when underlying systems evolve, the business definitions remain constant, allowing reports and applications to continue working without interruption. This enables organizations to iterate on their data infrastructure while maintaining consistency for end users.

## Core Components

### Sources

**Sources** represent datasets enhanced with business logic. They serve as reusable building blocks that encapsulate both data structure and semantic meaning.

```malloy theme={null}
source: orders is table('orders') extend {
  primary_key: order_id
  dimension: order_month is order_date.month
  measure: total_revenue is sum(order_amount)
  join_one: customers on orders.customer_id = customers.id
}
```

### Dimensions

**Dimensions** are scalar calculations that provide context for analysis—the "who, what, when, where" of your data. They represent categorical and descriptive attributes used for grouping and filtering.

Common patterns include:

* **Derived fields**: Calculations based on existing columns
* **Categorization**: Business logic creating meaningful groupings
* **Date/time transformations**: Extracting periods, formatting dates

### Measures

**Measures** are aggregate calculations that produce business metrics—the "how many, how much" of your data. They operate across multiple rows to generate summary statistics.

Standard aggregations include `count()`, `sum()`, `avg()`, `min()`, `max()`, and `count(distinct)`. Complex measures can combine multiple aggregations or apply business logic.

### Join Relationships

**Joins** define how sources connect, enabling analysis across related entities. Semantic models make relationships explicit with clear business meaning rather than implicit foreign key references.

Relationship types:

* `join_one`: One-to-one or many-to-one relationships
* `join_many`: One-to-many relationships
* `join_cross`: Cartesian products (used sparingly)

### Views

**Views** define reusable analytical patterns and query templates. They can be embedded in sources for organization-wide reuse or defined inline for specific analysis.

View operations include:

* **Reduction**: Group and aggregate data
* **Projection**: Select specific fields
* **Filtering**: Apply business conditions
* **Ordering**: Sort results by importance

### Filters

**Filters** are boolean expressions that restrict data to relevant subsets. They can be applied at multiple levels—source-wide, view-specific, or field-level—providing flexible data access patterns.

## Model Architecture

Semantic models transform the **natural graph** of all possible database joins into a **curated semantic graph** of meaningful business relationships. This curation process:

1. **Eliminates ambiguity**: Clear business meaning for each relationship
2. **Improves performance**: Optimized join paths and pre-computed aggregations
3. **Enables governance**: Centralized definitions and access controls
4. **Supports accessibility**: Business users can explore data intuitively

## Benefits of Semantic Modeling

**Consistency**: Business logic defined once, used everywhere across tools and applications

**Reusability**: Components referenced across multiple analyses and consumption patterns

**Governance**: Centralized definitions ensure data quality and regulatory compliance

**Performance**: Optimized query generation and intelligent caching strategies

**Accessibility**: Business users explore data through intuitive, self-service interfaces

**AI-Ready**: Structured definitions enable AI agents to provide accurate, contextual responses

This semantic foundation enables diverse consumption patterns—from traditional BI dashboards to embedded analytics to AI-powered insights—all working from the same trusted business definitions. The result is an organization that speaks a common data language, making decisions based on consistent, reliable information.

## Next Steps

* Understand [platform architecture](/concepts/architecture) to see how Credible implements and serves semantic models
* Learn about [AI-assisted modeling](/how-to/modeling/ai-modeling) to accelerate development
* Explore [governed platform](/concepts/governed-platform) for enterprise deployment
* Review the [Malloy Language Documentation](https://docs.malloydata.dev/documentation/) for detailed implementation guidance
