Writing your first measure

A worked example, from a total to a share of total.

A short walkthrough that ends somewhere genuinely useful.

1. A total

Start with the simplest possible measure: the sum of a column.

Revenue = SUM(orders[amount])

Put it on a card and you get one number. Put it on a bar chart by country and you get revenue per country — the same definition, evaluated per group. You did not write "per country" anywhere; the chart decided that.

2. A ratio

Now something with two parts:

Average order value = DIVIDE(SUM(orders[amount]), COUNT(orders[id]))

Use DIVIDE rather than the division operator when the denominator could be zero — it returns blank instead of an error, so one empty group does not break the whole visual.

3. A share of the total

This is where measures start doing something a column never could:

Share of revenue = DIVIDE(
  SUM(orders[amount]),
  SUM(orders[amount]) ignoring filters on orders
)

The numerator respects the chart's grouping and filters. The denominator deliberately ignores them, so it stays the grand total while the numerator varies. The result is each group's share.

That "ignoring filters" part is filter context, and it has a page of its own.

4. Name it for a reader

Rev_pct_tot is a note to yourself. Share of revenue is a label on a chart somebody else has to read. The name is part of the deliverable.

Writing your first measure · ChartBase Docs