Skip to main content

Building measures

A measure is a number that a report aggregates: a total cost, a count of accounts, a 7-day moving average, a change against last month. You build a measure by choosing a calculation and filling in a form. There is no free SQL editor for measures. This page explains what each group of calculations does.

For the complete list with formulas, see Measure, field, and recipe reference. Row-level facts belong in a Transform job or a Charge job. See Choosing where calculation logic belongs.

Author a measure​

You add a measure in two places, and each place offers its own list of calculations:

WhereHowWhat you can choose
A cubeOn the Fields tab, select Add field, then Add Measure. See Add a field.The Base measures
A viewSelect Edit, open Fields, and select New measure. See Working with fields in a view.The Base measures and every group of calculated measures on this page

The form asks for the calculation, its inputs, a title and a description, the number format, and the drill-down members. You also choose whether the measure is public or a hidden helper.

The New measure window, with the search field and the list of base measures.
The New measure window, with the search field and the list of base measures.

In a view, the list continues with Formulas, Time comparisons, Shares and ranking, Rolling and cumulative, and Conditional calculations.

New measure in a view, with the groups Formulas, Time comparisons, and Shares and ranking.
New measure in a view, with the groups Formulas, Time comparisons, and Shares and ranking.

A measure that you create in a view belongs to that view. To share it, see Field scopes and promotion.

Base measures​

A base measure is one aggregation that reads source data directly. In the form, these are under Base measures. Every other measure is a calculated measure: a formula, comparison, window, share, ranking, or condition.

CalculationWhat it returns
Row countThe number of rows
Count unique valuesThe number of unique values in a source field
SumThe total of a number source field
AverageThe mean of a number source field
MinimumThe smallest value
MaximumThe largest value
Prepared valueOne numeric value that a Transform job already calculated at the exact grain of the cube

An average of averages gives a wrong number. When each group must count in proportion to its size, use Weighted average. It weights each value by a second measure, such as quantity or hours.

Prepared value or Maximum?​

Choose Prepared value when a Transform job already calculated the number, such as a forecast, a score, or a control limit. You select the source field and do not define the formula again. Choose Maximum only when you want the largest value across the rows.

A Prepared value has the grain of the cube. A daily value per service is correct when a query groups by day and service, or filters to one service. A query that combines several days or services does not get a roll-up. If you need one, build it as its own measure.

Measure-level filters​

A measure can have its own condition, which limits the rows that it aggregates. "Production cost" can then stand next to total cost in the same report.

To add a sum for one category:

  1. In a view, select New measure and choose Conditional sum under Conditional calculations.
  2. Select the numeric Value field, such as cost.
  3. Under Filter condition, select the text Condition field, such as cost class.
  4. Set Operator to Equal to (=) and enter the Matching text, such as PROJECT.
  5. Select Continue, check the overview, and save the measure.

Conditional count works the same way and counts the matching rows.

SubjectRule
Text fieldsEqual to and not equal to. The match is exact, including case and spaces.
Numeric fieldsLess than, at most, greater than, at least, equal to, and not equal to
Empty textTo match an empty string, enter the matching text and clear it again. A missing category matches neither comparison.
No matching rowsA conditional sum is empty, not zero. A conditional count is zero.
CurrencySelect one currency, or group by currency.

The measure still follows the dates and the filters of the report.

Rolling windows​

A rolling window calculates a measure over a range of time that moves or grows. It needs a time dimension.

KindWhat it does
Trailing windowLooks back over a fixed span, such as a trailing 30-day sum
Moving averageCalculates a base measure once per time bucket, then averages those values over the window
Period-to-date totalAdds up from the start of the month, the quarter, or the year

A moving average also asks for:

FieldWhat to enter
Observation grainThe size of one time bucket. An hourly cube offers hour and coarser, a daily cube offers day and coarser.
Number of observationsHow many buckets the window covers
Reset dimensionsThe dimensions for which the average restarts. The list can be empty.
Missing periodsExclude them, or treat them as zero

With daily totals of 30 and 5, a moving average over two observations is 17.5. The number of source rows per day does not matter.

Rolling standard deviation, Bollinger bands, z-scores, control limits, and forecasts are not offered as measures. Calculate them in a Transform job and show them with Prepared value.

Time shifts and period-over-period comparisons​

A time shift compares a measure with the same measure in an earlier period: this month against last month, or this period against the same period a year ago.

CalculationWhat it returns
Previous period valueThe value of the earlier period
Change from previous periodThe current value minus the earlier value
Percent change from previous periodThe change as a fraction of the earlier value

These calculations accept a base measure or a compatible calculated measure.

To compare the current and the prior period in one KPI, use KPI vs prior period on the Guides tab of the view. It sets a date range comparison and creates no helper measures. See The authoring workspace.

Ranking​

A ranking measure orders the rows within a group and returns the position of each row. You choose the measure to rank by and the order: highest first or lowest first. Use it for "top N" reports, such as the services with the highest cost in each team.

Multi-stage calculations​

Some measures build on other measures.

  • Percent of total accepts Sum and Row count measures only.
  • Ratio, Difference, previous-period calculations, and Rank accept base measures and compatible calculated number measures.

To keep the field list short, make an intermediate measure a hidden helper.

Value meaning, display, drill-down, and view presentation​

These settings change how a measure reads, not what it calculates.

  • Value meaning, fraction digits, negative style, and value bands: see Display settings.
  • Drill-down members: the dimensions that a reader can expand into.
  • KPI thresholds, colors, trend direction, and bucket colors belong to the visualization and can differ between views. See Visualizations.

For monetary values, see Currency values.