DAX API Overview
The DAX API enables Power BI, Excel, and other Analysis Services-compatible tools to query your Olytix Core semantic layer using DAX (Data Analysis Expressions). This provides native integration with Microsoft BI tools while leveraging Olytix Core's unified semantic model.
Key Features
| Feature | Description |
|---|---|
| DAX Query Execution | Execute DAX queries against Olytix Core cubes |
| XMLA Protocol | Native Power BI connectivity via XMLA endpoint |
| Metadata Discovery | Expose cubes, dimensions, and measures to clients |
| Session Management | Stateful connections for Power BI Desktop |
| IntelliSense Support | Query completions for DAX editors |
Architecture
The DAX API translates DAX queries into Olytix Core semantic queries:
Power BI Desktop --> XMLA Protocol --> DAX Engine --> Semantic Layer --> Data Warehouse
- DAX Parser: Parses DAX syntax into an AST
- DAX Translator: Converts DAX concepts to Olytix Core semantic queries
- XMLA Handler: Implements XMLA protocol for Power BI connectivity
- Metadata Provider: Exposes cube metadata to clients
Concept Mapping
Olytix Core maps DAX concepts to semantic layer constructs:
| DAX Concept | Olytix Core Equivalent |
|---|---|
| Table | Cube |
| Column | Dimension |
| Measure | Measure |
| SUMMARIZECOLUMNS | Query with dimensions and measures |
| FILTER | Semantic filters |
| CALCULATE | Modified filter context |
API Endpoints
REST Endpoints
| Endpoint | Method | Description |
|---|---|---|
/api/v1/dax/execute | POST | Execute a DAX query |
/api/v1/dax/validate | POST | Validate DAX syntax |
/api/v1/dax/functions | GET | List supported DAX functions |
/api/v1/dax/completions | POST | Get IntelliSense completions |
/api/v1/dax/cubes | GET | List available cubes |
XMLA Endpoint
| Endpoint | Method | Description |
|---|---|---|
/api/v1/dax/xmla | POST | XMLA SOAP endpoint for Power BI |
Quick Example
Execute a DAX query via REST:
curl -X POST http://localhost:8000/api/v1/dax/execute \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "EVALUATE SUMMARIZECOLUMNS(orders[region], \"Total Revenue\", SUM(orders[amount]))"
}'
Response:
{
"columns": [
{"name": "region", "data_type": "String", "is_measure": false},
{"name": "Total Revenue", "data_type": "Double", "is_measure": true}
],
"data": [
{"region": "NORTH", "Total Revenue": 125000.00},
{"region": "SOUTH", "Total Revenue": 98500.00},
{"region": "EAST", "Total Revenue": 112000.00},
{"region": "WEST", "Total Revenue": 87500.00}
],
"row_count": 4,
"execution_time_ms": 45.2,
"from_cache": false
}
XMLA Protocol Basics
The XMLA (XML for Analysis) protocol enables Analysis Services-compatible tools to communicate with Olytix Core. XMLA uses SOAP over HTTP with two primary operations:
Discover
Retrieves metadata about cubes, dimensions, measures, and server properties.
<Discover xmlns="urn:schemas-microsoft-com:xml-analysis">
<RequestType>MDSCHEMA_CUBES</RequestType>
<Restrictions>
<RestrictionList>
<CATALOG_NAME>Olytix Core</CATALOG_NAME>
</RestrictionList>
</Restrictions>
<Properties>
<PropertyList>
<Catalog>Olytix Core</Catalog>
</PropertyList>
</Properties>
</Discover>
Execute
Executes DAX queries and returns results.
<Execute xmlns="urn:schemas-microsoft-com:xml-analysis">
<Command>
<Statement>
EVALUATE
SUMMARIZECOLUMNS(
orders[region],
"Revenue", SUM(orders[amount])
)
</Statement>
</Command>
<Properties>
<PropertyList>
<Catalog>Olytix Core</Catalog>
</PropertyList>
</Properties>
</Execute>
Supported Discovery Types
| Schema Rowset | Description |
|---|---|
| MDSCHEMA_CUBES | List available cubes |
| MDSCHEMA_DIMENSIONS | List dimensions in cubes |
| MDSCHEMA_MEASURES | List measures in cubes |
| MDSCHEMA_HIERARCHIES | List dimension hierarchies |
| MDSCHEMA_LEVELS | List hierarchy levels |
| DBSCHEMA_TABLES | List tables (cubes) |
| DBSCHEMA_COLUMNS | List columns (dimensions/measures) |
| DISCOVER_PROPERTIES | Server properties |
| DISCOVER_DATASOURCES | Data source information |
Session Management
XMLA supports stateful sessions for maintaining context across multiple requests:
# Create a session
curl -X POST http://localhost:8000/api/v1/dax/sessions \
-H "Authorization: Bearer YOUR_API_KEY"
# Response
{
"session_id": "sess_abc123",
"created_at": "2024-01-20T10:30:00Z",
"timeout_seconds": 3600
}
Include the session ID in subsequent requests:
curl -X POST http://localhost:8000/api/v1/dax/execute \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "X-Session-ID: sess_abc123" \
-H "Content-Type: application/json" \
-d '{"query": "EVALUATE orders"}'
Security
DAX queries respect Olytix Core's security model:
- Row-Level Security (RLS): Filters are automatically applied based on user context
- Column-Level Security: Masked columns return obfuscated values
- Authentication: API key or JWT token required
Supported DAX Functions
Olytix Core supports common DAX functions across these categories:
| Category | Examples |
|---|---|
| Aggregation | SUM, COUNT, COUNTROWS, AVERAGE, MIN, MAX, DISTINCTCOUNT |
| Filter | FILTER, ALL, ALLEXCEPT, CALCULATE, CALCULATETABLE |
| Table | SUMMARIZECOLUMNS, SUMMARIZE, ADDCOLUMNS, SELECTCOLUMNS |
| Information | ISBLANK, ISERROR, HASONEVALUE |
| Logical | IF, AND, OR, NOT, SWITCH |
| Date/Time | YEAR, MONTH, DAY, TODAY, NOW |
See DAX Queries for detailed function support.