Concepts
Measures and calculated tables
Understand what a measure is, why a filter or a split can give a number you did not expect, and how to save your own measure.
A measure is a number with a name, such as Net sales. You write its name in square brackets, and the query editor adds it up for your locations. This page explains what is behind a measure, so you can see why a number is what it is.
What a measure is
A name in square brackets is always a measure, for example [Net sales]. Names are not case sensitive, and they can contain spaces. Measures come from two places: the standard measures that YourBI provides, and the measures your organization saved. Both are in Measures.
A base measure adds up a column of one table. It can have a WHERE that limits what it counts.
SUM(fact_sales_line.TotalExclVat)A composed measure is built from other measures with plus, minus, times and divide by. It can have a WHERE too.
[Net sales] / NULLIF([Worked hours], 0)A measure is one value. It has no FROM, no list of columns and no GROUP BY. A text that has them is a calculated table.
A query that asks for measures starts with SELECT and names the measures. You do not write FROM or JOIN. The editor reads the tables and joins them for you. For the full SQL, see Query editor reference.
Standard measures and replacing one
The standard measures count the way most organizations count. A standard measure is read-only. To count in another way, you replace it with your own measure.
To replace one, open the standard measure and choose Duplicate. Give the copy a name that tells the difference, such as Net sales excl. deposits. You cannot use the name of the standard measure. The editor then asks "Replace Net sales for everyone?". Choose Replace, then change the SQL.
After the replacement starts, [Net sales] returns your number in every query, in every measure that builds on it, on your dashboards, and in the AI assistant. Only one measure can replace a standard measure at a time. A measure that is limited to some locations cannot replace one.
To see that a measure is replaced, look in Measures. The standard measure shows Replaced by and the name of your measure. Inside your replacement, [Net sales] still means the calculation that YourBI provides, so your measure does not call itself.
To go back, clear the replacement of your measure and choose Publish, or archive your measure. The standard measure then works again for everyone.
How a filter reaches a measure
A WHERE on a query applies to every measure in it. A WHERE on a composed measure reaches the measures it is built from.
A measure can only use a filter on a table it can reach. Net sales comes from sales lines, and a sales line points to a product. Worked hours comes from timesheets, and a timesheet has no product. So a filter on a product cannot reach Worked hours.
When a measure cannot reach the table of a filter, the editor skips the filter for that measure. It gives no message, and the measure returns its total.
SELECT [Net sales], [Worked hours]
WHERE dim_product.RevenueCategoryLevel1 = 'Drinks'| Net sales | Worked hours |
|---|---|
| € 12,400 | 1,250 |
Net sales is limited to Drinks. Worked hours is the hours of all staff at your locations. The same happens inside a composed measure. Net sales divided by Worked hours, with this filter, divides the Net sales of Drinks by the hours of all staff. That is rarely the number you want.
If a filtered number looks too high, compare it with the same measure without the filter. A measure can also ignore a dimension, such as the product. A filter on an ignored dimension does not reach that measure either, and the editor gives no message.
Split a measure with GROUP BY
A measure gives one number for your locations. GROUP BY splits that number into rows, one for each value of a column. Write the columns after GROUP BY as table.column, and separate several columns with a comma.
A measure is added up for each group. A measure that divides two other measures adds up both first and then divides. It does not average the averages of the groups.
A measure can only be split by a column its table can reach. When you split Worked hours by a product column, it still returns a number for each row. The number is the same total on every row.
SELECT [Net sales], [Worked hours]
GROUP BY dim_product.RevenueCategoryLevel1| dim_product.RevenueCategoryLevel1 | Net sales | Worked hours |
|---|---|---|
| Drinks | € 12,400 | 1,250 |
| Food | € 31,000 | 1,250 |
| Other | € 4,850 | 1,250 |
A repeated number is not an error. The editor shows a warning icon in the header of the column. Hover over it to read why. Do not add the rows up: 1,250 hours three times is 3,750 hours, and nobody worked that.
To group by a value made of several columns of one table, write an expression after GROUP BY, such as CONCAT(account number, ' - ', account name). The expression cannot use an aggregate such as SUM, OVER, a subquery or a measure.
Locations and dates
A query never says which locations it covers. The location button beside Run sets them for every table the query reads. A location is left out when the data the query reads is not available to you there. Your role decides that.
A measure can be limited to some locations. The query then runs for the locations you selected that the measure allows. This limit applies to the whole query: every other measure in the query is limited to the same locations. If none of your selected locations is allowed, Run is greyed out.
The query editor has no period. A query reads all dates unless its own SQL filters them. To read only some, put a condition on dim_date.Date in the WHERE, for example dim_date.Date >= '2026-01-01'. Write the dates between single quotes, as year, month and day.
Calculated tables
Use a calculated table when you need rows. A measure is one value, so it cannot hold rows. A query with FROM, a list of columns, GROUP BY, HAVING or a window is saved as a calculated table.
A calculated table holds the query, not a copy of its rows. The query runs again each time you use the table, so it is always as up to date as your data. You use it by name after FROM, with backticks around the name when it has spaces. If you change its columns, a query that uses the table can stop working. The editor then names the measures and calculated tables that use it.
Save your own measure
You need the Query editor permission with Can edit.
- Write the calculation, for example
[Net sales] WHERE dim_product.RevenueCategoryLevel1 = 'Drinks', and choose Run. - Choose Save, type a name such as
Drinks sales, and press Enter. - Ask for it by name:
SELECT [Drinks sales]. You get the same number as in step 1.
The editor saves your changes as you type. A new measure is private, so only you see it until you share it. A private measure is checked when you share it, not when you save it. To make one number for everyone, see Share and publish.
How a measure's values look
On a measure you can set Format, Decimals and Better when. They choose how its values look, and results show numbers in the number format of your organization.