Skip to main content

Charging rules

A charging rule sets the price of a measure in a Charge job, or changes an amount that the job calculated. Use rules for volume pricing, graduated pricing, markups, credits, and fixed amounts.

For every field of a rule, see the Charging rules reference.

How a rule finds its measure​

A rule applies to a measure only when the labels of the rule are exactly the labels of the measure. An extra or a missing label means no match. The rule also names one pricing target of the Charge job.

A measure with labels and no matching enabled rule keeps its value.

The labels of a measure and the pricing targets are part of the job instructions. The Charge job editor has no form for them. See Charging rules and labels.

Base schedules and adjustments​

A rule has one role:

  • A base schedule calculates the starting price from a quantity, with tiers. A target, group, and period can have at most one.
  • An adjustment changes the current amount. Each adjustment has its own whole-number priority, and a higher priority runs first.

Without a base schedule, the adjustments start from the value of the measure. With a base schedule, the Charge job adds up the quantity of the group, and the result of the schedule replaces the value. The quantity must be another measure than the one that is priced.

Volume and graduated pricing​

Take two tiers: from 0 up to 100 at 2.00, and from 100 at 1.50. For a quantity of 120:

ScheduleHow it calculatesResult
volumeOne tier applies to the complete quantity: 120 x 1.50180.00
graduatedEach tier applies to the quantity inside it: 100 x 2.00 + 20 x 1.50230.00

A quantity that is exactly on a boundary belongs to the next tier.

  • The first tier starts at zero.
  • Each tier starts where the one before ends, without a gap or an overlap.
  • A tier cannot start and end at the same value.
  • Only the last tier can be without an upper boundary.
  • Quantities and rates are not negative. For a credit, use an adjustment.

Adjustments​

An adjustment holds one or more actions. fixed replaces the current amount with a value, offset adds a positive or negative value, and percent multiplies the amount by 1 + percent / 100. A percent below -100 is not valid.

  • In one rule, the first action whose filter matches applies. You can add one last action without a filter for all other cases.
  • Each rule reads the result of the rule before it.
  • The amount is rounded once, at the end, for the complete group.

Filters​

A rule can filter only on a dimension that it also groups by. Every row of a group then has the same value, so the rule applies to the complete group or not at all.

To filter on a dimension, add it to the grouping of the target and of every rule for that target. This changes what tiers, fixed amounts, and allocation add up over: if you group by customer and provider, the tiers count the usage of each provider separately.

  • A dimension without a value matches no filter, also not not_equal or not_in.
  • The filter of an action reads a measure. If the measure has no value, the action does not match, and the next action is tried.

When a rule applies​

Each rule has a range in UTC: a start, and optionally an end. The start is part of the range and the end is not.

A rule applies to a billed period when the complete period lies inside the range. The time of the run plays no part, so one run can price older periods with one rule and newer periods with another. The boundaries of the range must match the grain of the Charge job.

Versions​

Every change to a rule creates a new version: an edit, enabling, disabling, and deleting. Earlier versions are kept.

A published workflow uses the rule versions that existed when you published it. To use a newer version, publish the workflow again.

Find and edit a rule​

Open the Charge job editor and select the Rules tab, after Grain. The tab shows only when charging rules are enabled for your organization. Each rule is a card with its name, its labels, and the measures that it matches, or Does not match a configured measure.

ControlUse it to
Applicable, All rulesShow the rules whose labels match a measure of this job, or all rules
SearchFind rules by a part of the name. Typing alone changes nothing: select Search or press Enter. Case is ignored: café finds CAFÉ, but strasse does not find Straße.
Exact nameFind the rule with exactly this name, including case and spaces
Any enabled state, Enabled, DisabledShow all rules, or only rules in that state
Clear searchRemove all search settings
Previous page, Next page, First pageMove through the results, with 25, 50, or 100 rules on a page

Select Add rule for a new rule, or select a rule to edit it. The rule editor opens at the side:

In the rule editorWhat you set
Name, Description, EnabledThe name, a note for other owners, and whether a workflow can use the rule
RoleBase for a base schedule, or Adjustment
Stable targetThe pricing target of the Charge job
PriorityThe order of an adjustment. A new adjustment starts at 100.
Commercial valid from, Commercial valid toThe range of the rule
Exact measure labelsThe labels, with Add label. The editor shows how many measures match.
Grouping dimension IDs, Typed criteriaThe grouping, and the filters with Add criterion
Base pricing scheduleFor a base schedule: Tier mode (Volume or Graduated), Quantity measure, and the tiers with Add tier
Ordered adjustment actionsFor an adjustment: each action with Add action, its Action kind (Fixed, Offset, or Percent), and Fallback action for the last action without a filter
Target allocationThe allocation of the target: None or Proportional by measure

Select Save rule when you are done. Back, Discard, and Back to rules close the editor without saving. Delete rule removes the rule and keeps its history.

If the editor reports that the rule changed or is unavailable, for example because another owner saved first, you cannot save. Copy the values that you want to keep, and open the rule again.

Allocation​

How a group amount is divided over rows is a setting of the pricing target of the Charge job, not of a rule. The rule editor shows it under Target allocation. See Pricing and allocation. To check a calculated amount, see Calculation evidence.

Problems that block publishing​

Hypermeter checks all rules of a Charge job before you can publish the workflow. It refuses a second base schedule, two adjustments with the same priority, wrong tiers, and a filter on a dimension outside the grouping. It also refuses these:

ProblemWhat to do
A range splits a billed periodMove the start or the end to a boundary of the grain.
An action or a filter names a field that does not existCorrect the field.
A rule tries to set the allocationSet the allocation in the Charge job.
Measures depend on each other in a circleA quantity cannot depend on the measure that it prices.
A decimal value is not written as a plain decimalWrite it without an exponent, for example 1.50.

For failures during a run, see Troubleshooting run failures.