How we built a Power BI Agent for governed DAX execution
Ask Titan's Power BI Agent uses governed semantic-model metadata and company-specific business context to understand the question, generate DAX and execute it against the configured semantic model.
The engineering problem
Generating DAX is the last step. Understanding the business question comes first.
A business user does not ask for a table, column or measure. They ask why margin declined, which customers caused the change, where yield was lost or how production performed.
Before the Power BI Agent can generate a query, it has to resolve the business meaning behind that question and identify the semantic context needed to answer it.
DAX is the output of that process, not the starting point.
“Which customers caused our margin decline last month?”
Company terminology and business definitions.
Semantic model, measures and relationships.
Only what is relevant to this question.
Combine the business meaning with the relevant semantic-model context and construct the executable query.
The difficult part happens before the DAX is generated.
What exists?
Tables, columns, data types, measures, relationships and sample values.
What does it mean here?
Company terminology, table and field descriptions, KPI meaning, jargon and process semantics encoded into governed metadata.
What matters now?
Only the tables, schemas, samples and prior execution feedback relevant to the current question.
Context engineering
Metadata is not enough. The agent needs business context
Context engineering is the broader practice of deciding which instructions, tools, external information, state and retrieved data reach the model at inference time. Ask Titan applies that idea to enterprise semantics.
We use business-context engineering as a practical specialization: encode company-specific terminology, definitions and process meaning around a semantic model, then select only the useful parts for the current question.
This is not a Power BI product term. It is how we describe the context-engineering pattern used around governed enterprise data.
A semantic model tells the AI how data is structured. Business context tells the AI what that data means inside your company.
Three layers of meaning
Structure, governed business logic and company-specific meaning are different things
Keeping these layers separate makes the runtime easier to govern. The semantic model remains the system that owns calculations and relationships. Ask Titan adds an explicit context layer around it instead of copying those semantics into one large agent prompt.
Technical metadata
Table and field names, data types and model structure tell the agent what can be referenced.
Power BI semantic model
Measures, relationships, hierarchies and DAX calculations remain in the semantic-model engine.
Business context
Descriptions and curated metadata explain how the organization uses concepts, fields and terminology.
Ask Titan control plane
Configure the semantic boundary before the question arrives
Ask Titan Webadmin is the control plane for the Power BI capability. Administrators configure the connection, select the semantic model, curate table and field descriptions and save the metadata used by the specialist agent at runtime.
Business documentation can also assist metadata generation. Suggested descriptions are reviewed and editable before they are saved. The runtime consumes the resulting governed metadata; it does not need to rediscover company meaning from scratch for every question.
One question through the capability
From business language to executed semantic-model query
Consider a user asking: “Which retail customers caused our margin decline last month?” The top-level orchestrator only chooses the permitted Power BI capability. The specialist agent owns the execution path behind that boundary.
tables = list_available_tables()
relevant = select_relevant_tables(question, tables)
for table in relevant:
load_governed_table_context(table)
dax = generate_dax(question, relevant_context)
result = execute_against_semantic_model(dax)
if result.has_error:
enrich_context_and_retry(result.error)
return result
Just-in-time semantic context
Do not put the entire semantic model into every model call
The specialist first sees the configured table catalog and descriptions. It then loads detailed information only for tables it may need. That detailed context can include field descriptions, data types, relationships and small samples.
When governed metadata exists in Ask Titan, that is used first. If it is unavailable, the implementation can fall back to live Power BI model metadata. This keeps the runtime useful without making curated context optional in the architecture.
List the configured table surface
Names and descriptions provide a lightweight map of the model.
Select likely relevant tables
The specialist chooses where deeper context is needed for this question.
Load detailed governed metadata
Descriptions, schema, relationships and samples enter the agent context only where needed.
Generate DAX from that subset
The generation step receives selected context rather than the entire semantic model.
DAX generation
Generate inside a known semantic boundary
The DAX generation step receives the user question plus the selected schemas, samples and previous execution errors. Public examples below are intentionally rewritten and do not expose Ask Titan's private prompts.
- Reference only known model fields.
- Use existing model relationships instead of rebuilding joins.
- Keep query generation separate from query execution.
- Carry execution feedback forward when correction is needed.
context = select_context(
semantic_model=model,
tables=relevant_tables,
include=[
"descriptions",
"schema",
"relationships",
"samples",
],
)
dax = generate_dax(
question=question,
context=context,
execution_feedback=previous_errors,
)
Execution
The model generates the query. The semantic-model engine calculates the answer
Ask Titan connects to the configured Power BI / Fabric semantic model and executes DAX through the semantic-model interface. The LLM does not calculate margin, aggregate rows itself or replace the model's measures.
Generated DAX
Executable query built from the selected context.
Semantic-model connection
Configured connection to the selected Power BI / Fabric model.
Result rows
Power BI evaluates model relationships, measures and DAX logic.
Execution-grounded correction
A failed DAX query becomes context for the next attempt
Query generation is not treated as a one-shot prediction. If the semantic-model engine rejects a generated query, the Power BI Agent stores that execution error in transient context. It can then inspect additional table information or generate a revised query.
The loop is designed with deterministic stop controls. We deliberately avoid publishing internal retry thresholds or treating model persistence as the safety boundary.
Choose the layer that owns the semantics
Why not translate every business question directly to SQL?
If margin, sales, yield or another business metric is already governed in a Power BI semantic model, rebuilding that definition in generated SQL creates a second interpretation layer. The Power BI specialist exists so the orchestrator can use the execution model that already owns those semantics.
| Question characteristic | Power BI semantic model | Raw SQL path |
|---|---|---|
| Governed measures already exist | Reuse the existing measure logic | May require reimplementing the metric |
| Relationships and hierarchies matter | Use the model's existing semantic structure | Agent must reason about joins and grouping |
| Detailed operational records are primary | Can be appropriate, depending on model design | Often a natural execution path |
| Business consistency with reports | Shares the same governed semantic layer | Depends on how the SQL layer is governed |
Governance boundaries
Capability access, source access and semantic meaning are separate controls
Article 3 covered whether the current identity may use the Power BI capability at all. Article 4 starts after that decision. The configured source identity still determines what the semantic-model connection can access, while the model itself owns measures, relationships and other semantic logic.
Capability authorization
May this user invoke the Power BI specialist capability?
Power BI authorization
What can the configured connection identity access in Power BI / Fabric?
Model logic
Which measures, relationships, fields and definitions exist in the selected semantic model?
Engineering takeaway
Do not teach the top-level agent how Power BI works
Put Power BI semantics behind a specialist capability. Configure the connection and company meaning in the control plane. At runtime, select relevant context, generate DAX, execute it in the semantic-model engine and treat the returned rows as evidence.
Patterns we keep
One architecture, three responsibilities
You should not have to teach the model your business in every prompt. Configure that context once and make it part of the governed AI runtime.
Next in the series
Part 5 · Conversation state + LLM context
How does Ask Titan remember a conversation without sending every previous tool call and result to the model? Part 5 covers LangGraph checkpoints, thread-scoped state, context selection and how oversized tool outputs are handled.
Read Part 5FAQ
Power BI AI agent, DAX and context-engineering questions
Practical answers about semantic-model context, Ask Titan Webadmin, DAX generation, Power BI execution and governance boundaries.
What is business context engineering in Ask Titan?
It is Ask Titan's application of the broader context-engineering pattern to enterprise semantics: administrators curate company-specific descriptions and metadata around a semantic model so the Power BI specialist can use that meaning at runtime instead of rediscovering it from every prompt.
How is context engineering different from prompt engineering?
Prompt engineering focuses mainly on instructions. Context engineering is broader: it determines which instructions, tools, metadata, external information, state and execution feedback are placed in front of the model for a particular inference step.
What Power BI context can the specialist agent use?
The runtime can use configured table descriptions plus detailed schema information such as field descriptions, data types, relationships and sample values. If governed metadata is unavailable, the implementation can fall back to live semantic-model metadata.
Can business documentation help create the metadata layer?
Yes. In the Ask Titan control plane, business documentation can assist the generation of table and field descriptions. An administrator can review and edit those suggestions before saving the resulting metadata for runtime use.
Does Ask Titan send the whole semantic model to the LLM for every question?
No. The specialist first works from a lightweight configured table surface and loads detailed table context only where it is relevant to the current question. DAX generation can then use that selected subset.
Why query the Power BI semantic model instead of always generating SQL?
When business measures, relationships and hierarchies already live in the semantic model, querying that model reuses the governed business logic instead of reconstructing a second definition in generated SQL.
How does Ask Titan execute DAX?
The specialist generates DAX and sends it through the configured Power BI/Fabric semantic-model connection. The semantic-model engine evaluates the query and returns result rows; the LLM does not calculate the metric itself.
What happens if generated DAX fails?
The execution error is stored as transient context for the specialist. The agent can inspect additional model information or generate a revised query, subject to deterministic stop controls.
Is Power BI capability authorization the same as Power BI data authorization?
No. Ask Titan application policy determines whether the current identity may invoke the Power BI capability. The configured Power BI connection and source-native permissions separately determine what the semantic-model connection can access.
Does this architecture automatically pass through each end user's Power BI RLS?
No such claim should be inferred. Row-level and source-native authorization depend on the identity and connection model used in a deployment and remain separate from Ask Titan's application-level capability authorization.
Business context engineering
Give AI access to governed business meaning, not just table names
Ask Titan combines semantic-model execution with a control plane for connectivity, metadata and company-specific context. That gives specialist agents a stable semantic boundary without moving business logic into one giant prompt.
From configuration to answer
Technical references
The Ask Titan implementation details in this article are simplified from the private product code. These public references document the broader context-engineering pattern and the Power BI semantic-model/DAX interfaces used in the architecture.