Overview
Dimensions are attributes that describe your entities. They’re used for grouping, filtering, and segmenting data (like order status, customer name, or product category). Dimensions provide the descriptive context for your data and enable slicing and dicing your metrics.Dimension Types
Oxy supports five dimension types:| Type | Description | Example Values |
|---|---|---|
string | Text and categorical data | ”pending”, “John Smith”, “Electronics” |
number | Numeric values | 42, 3.14, 1000 |
date | Date values | ”2024-03-15” |
datetime | Date and time values | ”2024-03-15T14:30:00Z” |
boolean | True/false values | true, false |
Dimension Properties
| Property | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Unique identifier within the view |
type | string | Yes | Data type |
description | string | No | Human-readable description |
expr | string | Yes | SQL expression |
samples | array | No | Example values for documentation |
synonyms | array | No | Alternative names for natural language queries |
Examples
String Dimensions
Number Dimensions
Date Dimensions
DateTime Dimensions
Boolean Dimensions
Computed Dimensions
Use SQL expressions to create derived dimensions:Using Synonyms
Synonyms help AI agents understand natural language queries. Add common alternative names for your dimensions:- “What’s the total sales this month?”
- “Show me income by region”
- “List all orders by purchase date”
Sample Values
Provide sample values to help users and AI agents understand the dimension’s possible values:Best Practices
Naming
- Use descriptive names without prefixes (e.g.,
order_datenotdim_order_date) - Be consistent with naming conventions across views
- Use business terminology rather than technical names
Documentation
- Always provide clear descriptions
- Include samples for categorical dimensions
- Add synonyms for dimensions commonly referenced with different terms
- Document any special logic in computed dimensions
Expression Design
- Keep expressions simple when possible
- Use
NULLIFto handle division by zero - Consider database-specific SQL syntax
- Test complex expressions thoroughly
Type Selection
- Use the most specific type (e.g.,
dateinstead ofstringfor dates) - Be consistent with types across related dimensions
- Match the underlying database column type