Measure editor

The measure editor is a floating panel beside the BI tables panel where you write a measure: its name, its SQL expression and its description. It opens when you add a measure or open one for editing, and its lower panes hold the Description, the Tests and a Preview.

For the library around it, its folders and the hide control, see Measures. Tests and previews have their own page: Measure tests.

Write the expression

  1. Open the measure from BI tables, or add a new one with Add measure.
  2. Type the expression in the SQL editor under the name field.

Name and describe the measure

Generate the expression with the measure AI

  1. Press Ctrl+Shift+M, or click the AI measure control in the editor header.
  2. Describe the measure in the box, for example Revenue share of each region within its year..., and click Generate.
  3. Review the expression the AI writes into the editor, then save it.
Note

The measure AI needs Use DataPrism AI and edit access to the semantic model. See Who can do what in DataPrism.

Start from a ready-made pattern

The Measure builder offers ready-made patterns by category. Open it from the editor; its tooltip reads Measure builder - <n> ready-made use cases once the catalogue has loaded.

  1. Pick a category, then pick a use case. Search the use cases by name or description.
  2. Fill in every parameter. Each one is required and marked with *, and the Generated SQL preview reads -- fill all inputs to generate SQL until the form is complete.
  3. Click Use this measure to hand the configured SQL to the editor. Refine it and save. Cancel closes the builder without changing the measure.

Save, discard and leave

Fix a failed save

When a save is refused, a banner above the editor shows the reason. Click the message to open the full text in View full message. The banner offers:

Two cases are special:

If the expression uses a pattern that is no longer allowed, the editor warns that the measure still runs and must be fixed before its next save.

Compare, copy and restore versions

  1. Open Measure history in the editor header. Saved measures have versions; a draft does not.
  2. Pick a version under Versions. The newest is first, and each row shows its version, date and author.
  3. Read the Expression tab, or switch to Compare to see the version beside the Current expression.
  4. Click Copy expression to copy it, or Restore to load it back into the editor.

See what a measure depends on

Format the measure's values

Keyboard shortcuts

ShortcutWhat it does
Ctrl+EnterSaves the measure. Inside the Measure name field it generates the expression from the name when the measure AI is available.
Ctrl+SpaceShows table, column and function suggestions.
Ctrl+Shift+FFormats the expression.
Ctrl+Shift+MOpens the AI measure popover.
Ctrl+ZUndoes an edit, including an expression the AI replaced.
EscapeCloses the editor; while the suggestions are open, it closes them first.

On macOS, use Cmd where the table shows Ctrl.

Questions, answered

Why did the editor reopen as a small panel?

The editor remembers its size only while it stays open; every fresh open starts compact. Click Expand for the full height, or open a pane: opening Description, Tests or Preview expands it too.

What happens to my unsaved measure if I leave the editor?

The editor asks first with Unsaved changes and You have unsaved changes to this measure. Leave without saving?. Leave drops your edits; a measure you never saved disappears. Even an empty draft counts as unsaved work, so the editor asks before it closes.

Can I undo what the AI wrote into my expression?

Yes. The AI replaces the expression in one change that stays on the undo stack, so Ctrl+Z restores the expression it replaced.

Why does a chip under Depends on show a warning?

The expression references a measure that does not exist. Create a measure with that name, or update the expression: No measure named "<name>" exists. Create it or update the expression.

What is the AI notes message?

After the AI writes or fixes an expression it can attach reading notes, shown as the AI notes toast. If it cannot write one, the message reads Failed to generate the measure expression and the popover stays open for another try.

Why did my save ask me to choose Reload or Overwrite?

Someone, or the AI, saved a change to this measure after you loaded it, so the banner reads This measure was changed by someone else or the AI. Overwrite saves your version on top of the newer one; Reload shows the newer version instead, so redo your edit.

When should I use Fix with AI instead of Continue in AI chat?

Fix with AI repairs the failing expression in place and reports AI updated the measure - review and save. Continue in AI chat opens the problem in the Model AI chat when you want to work through it in a conversation. Both need Use DataPrism AI and edit access to the semantic model.

Why can't I format my measure's values yet?

Formats belong to a saved measure. Until you save, the tools bar reads Save this measure to configure how its values are displayed.

Why is Format expression disabled?

It needs an expression to format. The control is off while the expression is empty, while the measure is saving and while the AI is generating.

Why is Use this measure disabled in the Measure builder?

The builder writes SQL only when every parameter is filled. Each parameter is required and marked with *; the preview reads -- fill all inputs to generate SQL until the form is complete.

What does the window function tag mean in the Measure builder?

The pattern's expression uses a SQL window function. The Generated SQL preview shows the query it will write, and a windowed measure is marked in the editor's suggestion list.

Can two measures be named Revenue and revenue?

Yes. Measure names are compared exactly, so Revenue and revenue can both exist in one model. Keep names clearly different to avoid confusion.