Skip to content

Tune context

Where: Settings › Databases › row menu › Export context / Import tuned context; Context › Tabular › Custom Measure › Sync Power BI; the edit panels in Context › Visualization and Tabular for annotations
Who can use it: Admins and Owners. Users can view annotations but not change them. Viewers don't see the Context page.

Export a database's context as a file, fix its dimensions, measures, descriptions, and joins in bulk, yourself or with the Tursio team, and import it back in one step. Sync measures and descriptions from Power BI so answers use the same definitions as your reports. Add business rules (annotations) to descriptions so Tursio picks the right columns.

Export context

  1. Open Settings › Databases.
  2. Open the row menu (⋯) on the database and select Export context.
  3. Pick a Format. ZIP is the full context and can be imported again. Use it when you tune with the Tursio team. Excel is a workbook with one sheet per context type. Use it to review and edit the context yourself.
  4. Select Export ZIP or Export Excel. The file downloads and Tursio shows Context exported.

Export context dialog with the Excel format selected (1) Format, (2) Export Excel.

Both formats include the table setup (name, database, description), fields (dimensions, measures, descriptions), custom measures (expressions and status), and aliases (alternate names and disabled aggregations).

Excel workbook sheets

The Excel export is named <connection>_query_table.xlsx and has these sheets:

Sheet Holds
Tables Table setup
Dimensions Dimension columns
Measures Simple measures
Pii Columns marked as personal data
Feedback Feedback on columns
MeasureConfig Measure settings, such as alternate names
CustomMeasures Custom measures
KpiMeasures KPI measures
Joins Join relationships
Policies Policies

The ZIP export is named <connection>.zip. It holds the context file query_table.json and the training outputs for the database.

Import a tuned context

  1. Open the row menu (⋯) on the database and select Import tuned context.
  2. Upload the file. The dialog takes one .json or .xlsx file up to 10MB. To import a ZIP export, upload the query_table.json file from inside it.
  3. Select Validate. Tursio checks the file's structure and checks that every table and column in it exists in the database.

    Import tuned context dialog with the file drop area (1) Drop the JSON or Excel file, (2) Validate.

  4. Select Apply changes. When the file passes, the dialog shows Your file is valid and ready to apply and a summary of what changes, for example 2 added · 1 measures modified. Tursio shows Context updated successfully.

    Import tuned context dialog showing a valid file (1) Validation result, (2) Apply changes.

  5. Retrain the database. After an import, the database's training status is Stale. Run training so searches use the imported context. See Run training.

If validation finds problems, the dialog lists each issue and the button reads Fix and re-upload. Select it, fix the file, and upload it again. Common issues:

Message Fix
Table '…' is not in database '…'. Remove it from the file, or import the file into the database it came from. Import the file into the database it was exported from, or remove the table.
Table '…': column(s) … are not in database '…'. Remove them from the file. Remove the columns, or check their spelling.
Table '…': no columns could be read from database '…' under this name. Spell the table exactly as the database does, including upper and lower case.
…: feedback['…'] display name '…' conflicts with … Give each column a unique display name. See Unique display names.

Import replaces the context

Applying an import overwrites the database's current context with the file. Export the current context first if you may want it back.

Tune context with the Tursio team

Tuning helps when test questions return the wrong result: a query uses the wrong join, picks the wrong column, or misreads a business term such as "revenue". You run sample questions and share feedback. The Tursio team tunes the context and sends it back for you to import and re-test. Repeat until the results are right.

Step 1: Set up and train

  1. Add query tables. Query tables decide which tables and views Tursio can query. See Query tables.
  2. Run training. Select Run training in the Settings page header, pick the Database, and start the run. See Training.

    Train database dialog (1) Database, (2) Run training.

  3. Review the recommended joins. On the Context page, open Tabular › Join Relationships. Accept the joins that match your data model, reject the wrong ones, and add any that are missing. Tursio ignores pending and rejected joins. See Join relationships.

Retrain after join changes

Join changes take effect after you retrain. Retrain before you start testing.

Step 2: Test and give feedback

  1. Run the test questions. Use questions your users really ask, especially ones with business terms.
  2. Export the query history. On Insights › Query history, download the test questions and their results to Excel. See Query history.
  3. Add feedback to the Excel file. For each question that looks wrong, say what was wrong and what you expected. See Writing useful feedback.
  4. Export the context as a ZIP. See Export context.
  5. Send both files to the Tursio team. The team reviews your feedback, tunes the context, and returns a tuned file.

Writing useful feedback

Specific feedback leads to better tuning in fewer rounds. Vague feedback leaves the team guessing.

Vague Specific
"Bad number." "When the question mentions 'revenue', use revenue_amount, not gross_amount."
"This is wrong." "Join orders to customers on customer_id, not on email."
"Doesn't make sense." "For 'category', use sub_category instead of major_category. It has finer detail."

A good comment names the question, says what the query did wrong, and says what it should do instead. Name the columns, joins, or terms involved.

Step 3: Import and re-test

  1. Import the tuned file. See Import a tuned context.
  2. Retrain the database. If you train a main connection that is already trained, Tursio suggests a dev connection instead. See Dev connections.
  3. Re-test the questions once training finishes, and compare the results with what you expected.
  4. Repeat Step 2 for any questions that still need work.

Sync from Power BI

A Power BI sync reads the Power BI semantic models you pick and imports what's defined there. On the Custom Measure page it imports measures: Tursio translates each DAX measure to SQL. On the Dimensions page it imports table aliases, column display names, and table and column descriptions.

Before you start

  • Power BI sync is available on SQL Server, Azure SQL, and Fabric Warehouse connections.
  • You need a Microsoft Entra app (service principal) that can read your Power BI workspaces: its tenant ID, client ID, and a client secret.
  • Train the connection before you sync.

Connect Power BI to a database

  1. Open Settings › Databases and add the database, or select Edit in its row menu. See Databases.
  2. Turn on Power BI Configuration.
  3. Enter the Power BI Tenant ID, Power BI Client ID, and Power BI Client Secret.
  4. Select Connect to Power BI. Tursio shows Connected to Power BI and lists your workspaces and their datasets.

    Power BI Configuration in the Add database dialog (1) Power BI Configuration, (2) tenant ID, client ID, and client secret, (3) Connect to Power BI.

  5. Select the datasets to sync under Select datasets to sync.

  6. Select Validate, then Add (or Update when you edit).

    Datasets to sync with one dataset selected (1) Connect to Power BI, (2) pick datasets, (3) Validate.

When you edit the database later, the client secret field is empty. Connect to Power BI stays disabled until you enter the secret again. If you leave the secret empty and save, Tursio keeps the stored one.

Sync measures and metadata

  1. Open the Context page and pick the database.
  2. Open Tabular › Custom Measure to sync measures, or Tabular › Dimensions to sync aliases, display names, and descriptions.
  3. Select Sync Power BI. The button shows only for databases with Power BI configured. Tursio shows Power BI sync complete. and a Power BI sync summary, for example Measures: 2 imported, 2 skipped.
  4. Select Download sync report to get a CSV with each item, whether it was imported or skipped, and why.

Custom Measure page after a Power BI sync (1) Sync Power BI, (2) sync summary, (3) Download sync report.

Imported measures appear in the Custom Measure table with a Status. Some arrive as PENDING for you to review. To review measures, see Custom measures. After a metadata sync, the database's training status is Stale. Retrain it so searches use the new names and descriptions.

Annotations

Annotations are business rules you add to a column, measure, or table description. They tell Tursio which column to pick, how to treat a hierarchy, and how much detail to show the query engine, much like hints in a traditional query engine. You add them in the Dimension, Simple Measure, Custom Measure, and Query Table panels in Context › Visualization, and in the Dimensions, Simple Measure, and Custom Measure tables in Context › Tabular.

Tursio picks columns from their names, descriptions, and sample values. When two columns look alike, or a business term maps to one specific column, Tursio can pick the wrong one. A rule states your intent once, and Tursio applies it to every question that touches that column, so answers stay consistent.

Each rule has a type and a description. The editor offers four types:

Rule in the editor Keyword in the description What it does
Enforce enforcer_rule Use this column when a question mentions certain business terms.
Priority prioritization_rule Prefer this column over others when several could fit.
Hierarchy hierarchical_rule Explain how this column relates to others in a hierarchy, and how to filter across levels.
Simplify simplification_rule Show the query engine a short description in place of the full description and sample values.

Plain text that comes before the first rule is the description itself. Tursio passes it to the query engine as context, but doesn't treat it as a rule.

Add rules in Visualization

  1. Open Context › Visualization and pick a database.
  2. Select a dimension or measure in a table node, then select Edit.
  3. Open the rules view in Column Description with the rules icon. The other icon switches to the plain description.
  4. Pick a rule type in Select rule and type its text in Enter description.
  5. Select + Add more to add another rule. Each type can appear once per description. Select the trash icon to remove a rule.
  6. Select Save.

The Table description in the Query Table panel takes rules the same way. Table rules guide which table Tursio picks. For the panels and their other fields, see Visualization.

Add rules in Tabular

  1. Open Context › Tabular › Dimensions and pick a query table.
  2. Select Edit Semantics (the pencil icon).
  3. Type the rule text in the Enforce, Priority, Hierarchy, or Simplify column for the row. Type only the rule text, not the keyword.
  4. Select Save (the check mark).

The Simple Measure and Custom Measure tables show a measure's Enforce, Priority, and Hierarchy rules in their own columns. To change them, edit the measure. The Update simple measure and Update custom measure dialogs have the same Column Description rules editor as Visualization. For the rest of the tables, see Tabular.

Validate a rule

Check how a rule changes answers before you save it.

  1. Select Validate. It sits next to Column Description when you edit a dimension or measure in Visualization, and in the measure dialogs in Tabular. In Tabular › Dimensions, it's on each row.
  2. Type a question that uses the column under Validate with a query.
  3. Review the answer. Tursio answers with the rule applied to that column only. Nothing is saved.
  4. Close the dialog, then adjust the rule or save it.

Rule types

Prioritization rules

In the editor: Priority · Keyword: prioritization_rule

Defines how to choose one column over another when several columns could answer a question. Use it to guide selection by granularity, completeness, or relevance.

Example:

prioritization_rule: prefer this column over major_category when
available, as it has finer granularity.

Use cases:

  • Prefer finer granularity columns in filtering
  • Prefer more complete or accurate columns
  • Prefer columns with better data quality

Enforcer rules

In the editor: Enforce · Keyword: enforcer_rule

Defines which column to use when certain business terms appear in a question. The query engine must follow these rules.

Example:

enforcer_rule: use this column when the question mentions
'category code' or 'category identifier'. The category code is in strict form
of 6 alphanumeric characters.

Use cases:

  • Map business terminology to specific columns
  • Enforce column usage for specific business concepts
  • Ensure consistent column selection for domain-specific terms

Hierarchical rules

In the editor: Hierarchy · Keyword: hierarchical_rule

Defines how to handle hierarchical columns, such as major_category, sub_category, and category_description. These rules say how to filter and combine levels.

Example:

hierarchical_rule: this is part of a hierarchy with
major_category and category_description. sub_category is finer granularity
compared to major_category but less granularity compared to category_description.
Use finer granularity to filter if filter value is specific. Use AND conditions
when filtering multiple levels when needed, not OR.

Use cases:

  • Define hierarchical relationships between columns
  • Specify filtering behavior (AND vs OR) for multiple levels
  • Guide granularity selection in hierarchies

Simplification rules

In the editor: Simplify · Keyword: simplification_rule

Syntax: simplification_rule: [ENABLE] <short_description> or simplification_rule: [SKIPPED]

Controls whether a dimension is simplified for the query engine. With [ENABLE], the query engine sees the short description in place of the column's description and sample values. [SKIPPED] leaves the column as is. Tursio adds this rule during training to every dimension that doesn't have one yet, so rules you add or edit are kept. Simplify applies to dimensions only.

Example:

simplification_rule: [ENABLE] Two-letter US state code.

General description

Keyword: general_description

Marks plain descriptive text. It isn't a rule, and the editor doesn't list it. The easiest way to add general information is to type it before any rule, or in the plain description view of Column Description. Tursio passes that text to the query engine as context.

If you type general_description: after a rule, it ends that rule. Its text isn't read as part of the rule and isn't used in query generation.

Multiple rules

You can put several rules in one description. Each rule runs from its keyword to the next keyword or the end of the text, so the order doesn't matter.

Example:

hierarchical_rule: this is part of a hierarchy with major_category and
category_description. Use AND conditions when filtering multiple levels, not OR.
prioritization_rule: prefer this over major_category when available.

Syntax rules:

  • A colon after the keyword is optional. Tursio drops the colon and surrounding spaces from the rule text.
  • Tursio reads keywords in any case. Write them in lowercase so the Visualization editor shows each rule as its own entry.
  • A keyword can't appear inside a rule's text or the description. The editor shows "The keyword "…" is reserved and cannot be used in the description."

Examples

Example rule sets (column name → description)

Hierarchical columns

{
"major_category": "Top-level category classification. hierarchical_rule: this is the coarsest level in the hierarchy",
"sub_category": "hierarchical_rule: this is part of a hierarchy with major_category and description. Prioritize finer granularity. Use AND conditions when filtering multiple levels, not OR. prioritization_rule: prefer this over major_category when available",
"description": "hierarchical_rule: this is the finest granularity level in the hierarchy. prioritization_rule: prefer this when the finest level is needed"
}

Business term mapping

{
"revenue_amount": "enforcer_rule: use this column when the question mentions 'revenue', 'sales', or 'income'",
"cost_amount": "enforcer_rule: use this column when the question mentions 'cost', 'expense', or 'expenditure'"
}

Data quality prioritization

{
"customer_code": "prioritization_rule: use this for filtering specific customers. Don't use customer_id as it is not populated in many cases."
}

Tips and limits

  • Import doesn't work while the database is training. Wait for training to finish.
  • Import takes .json and .xlsx files up to 10MB, one file at a time.
  • Every table and column in an imported file must exist in the database. Import a file into the database it came from.
  • After an import, the database stays Stale until you retrain it.
  • A measures sync needs a trained database. Tursio translates DAX against the trained schema.
  • A metadata sync adds aliases and doesn't remove existing ones. It overwrites display names and descriptions, but keeps any business rules in a description. Tursio skips a display name that another column in the database already uses.
  • If the sync can't sign in, Tursio shows Power BI authentication failed; check the service-principal credentials. Check the app's tenant ID, client ID, and secret.
  • Tursio skips Power BI measures it can't translate to SQL or add to the database. Download sync report lists each skipped measure and the reason.
  • A Power BI sync only reads your Power BI models. It changes the context in Tursio, not Power BI.
  • To import measures from a Power BI file instead of a live connection, see Import from Power BI.
  • Each rule type can appear once per description in the editor, so a description holds at most four rules.
  • Simplify only changes how dimensions are shown to the query engine. On measures and tables, use Enforce, Priority, and Hierarchy.
  • Validate doesn't save anything. Select Save to keep the rule.
  • You can edit a Simplify rule that Tursio added, or change it to [SKIPPED].
  • Keep rule text specific, with clear, actionable guidance.
  • When columns form a hierarchy, use Hierarchy rules to define how they relate and how to filter across levels.
  • Combine rule types when needed, such as Priority and Hierarchy.