Find a billable metric
Find a billable metric in the Billable Metrics list by name. You can also narrow the list with filters and sorting.Prerequisites
- You need a role with the Can Read Billable Metric permission. See Permissions.
Search for a billable metric by name
- Go to Usage > Billable Metrics.
- In Search Billable Metric, enter part of the name.
- Select the billable metric from the results.
Filter the list
- Go to Usage > Billable Metrics.
- Click FILTER.
- In Filter by…, select Name or Created At.
- Select a condition and a value.
- Click APPLY FILTER.
Sort the list
- Go to Usage > Billable Metrics.
- Click a column header. The list sorts by that column in ascending order.
- Click the column header again to sort in descending order.
- Click the column header a third time to remove the sorting.
Create a billable metric
Create a billable metric with one of two builders. Both builders save the same kind of billable metric. Both end with the same naming step.
You can start in the visual builder and move to the SQL builder later. You cannot move back. See Move a billable metric to the SQL builder.
Prerequisites
- You need a role with the Can Create Billable Metric and Can Read Billable Metric permissions. See Permissions.
- The usage-event collection or the data source that the billable metric reads must exist. See Create a usage-event collection and Add a data source.
Open a new billable metric
- Go to Usage > Billable Metrics.
- Click ADD NEW BILLABLE METRIC. The Add New Billable Metric screen opens with VISUAL BUILDER selected.
Build the billable metric
- Visual builder
- SQL builder
- Under Select tables & filters, in Table Name, select the table. Usage-event collections are listed under Usage Event by their API slug. Tables of synced usage data are listed under Data source.
- Optional: Click + ADD FILTER. Select a Column and a Condition, and enter a Value. Repeat for each filter. To remove a filter, click its delete icon.
- Optional: To add a group of filters, click + NEW FILTER GROUP. To switch between AND and OR, click the AND or OR button between the filters or the groups. To remove every group except the first, click CLEAR ALL FILTER GROUPS.
- Click NEXT.
- Under Map customer, in Your customer column, select the column that identifies the customer. In Zenskar customer column, select email, external_id, customer name, or Custom attribute:
<name>. A custom attribute shows only when it belongs to customers and has the data type Text, Whole number, or Dropdown. - Click NEXT.
- Under Set date field, in Column, select the column that dates each row. If it is not
timestamp, select its Date Format. - Click NEXT.
- Under Set Billable Metric over, in Select calculation type, select the calculation type. In Select column to calculate over, select the column.
Name and save the billable metric
- Optional: Check the result. See Preview a billable metric.
- Click CREATE BILLABLE METRIC. The Choose Billable Metric Name window opens.
- Enter the name.
- Click CREATE BILLABLE METRIC.
Fix a failed save
- CREATE BILLABLE METRIC stays unavailable in the visual builder until you reach Set Billable Metric over. In the SQL builder, it stays unavailable until you click EDIT and confirm.
- NEXT does not move on when the table has no columns or a filter is incomplete. Choose another table, or complete the filter.
- Zenskar rejects a query whose Zenskar SQL variables are not valid. Correct the variables.
Preview a billable metric
Run a billable metric for a customer and a period before you save it. Check the number that it gives.Prerequisites
- You need a role with the Can Read Billable Metric permission. See Permissions.
Run the preview
- Open the billable metric in the editor, or build a new one. See Create a billable metric.
- Under Query preview, in Search By Customer Name, External ID, select the customer. In the visual builder, the field is available from Map customer on.
- In the SQL builder, if the query uses a contract or product variable, select the contract in Contract or the product in Product.
- In Billing Period, select the first and last days of the period. In the visual builder, the field is available from Set date field on.
- Click RUN QUERY. In the SQL editor, you can also press Ctrl+Enter, or Cmd+Enter on a Mac.
Fix a failed preview
- In the SQL builder, Zenskar does not run the preview when the query uses a variable that has no value. Select the customer, the contract, the product, or the dates that the query uses.
- In the visual builder, Zenskar does not run the preview without both dates of Billing Period. Select both dates.
- When the query has an error, the table area shows the error. Correct the query. Run it again.
Edit a billable metric
Change how a billable metric reads and calculates usage. A change applies to every pricing preset that uses the billable metric. Changing a billable metric can affect contracts and invoices.Prerequisites
- You need a role with the Can Update Billable Metric and Can Read Billable Metric permissions. See Permissions.
Change the billable metric
- Go to Usage > Billable Metrics.
- Click the billable metric. You can also open its actions menu and click Edit. The billable metric opens in the editor, with its name as the title.
- Change the billable metric in the builder that it uses:
- A billable metric from the visual builder opens at Set Billable Metric over. To change an earlier step, click BACK.
- A billable metric from the SQL builder opens with the query ready to edit.
- Optional: Check the result. See Preview a billable metric.
- Click SAVE CHANGES.
Move a billable metric to the SQL builder
Move a billable metric from the visual builder to the SQL builder, for example to add a dimension or a condition that the visual builder does not cover. Zenskar converts the settings of the visual builder into a query.Prerequisites
- You need a role with the Can Update Billable Metric and Can Read Billable Metric permissions. See Permissions.
Move the billable metric
After you save, the billable metric cannot return to the visual builder. Preview the converted query before you save.
- Open the billable metric in the editor. See Edit a billable metric.
- Click SQL BUILDER. The editor shows the converted query, read-only.
- Click EDIT. In SQL Builder Edit Access, click YES.
- Optional: Change the query.
- Preview the billable metric. See Preview a billable metric.
- Click SAVE CHANGES.
Rename a billable metric
Change the name of a billable metric. The calculation does not change.Prerequisites
- You need a role with the Can Update Billable Metric and Can Read Billable Metric permissions. See Permissions.
Change the name
- Open the billable metric in the editor. See Edit a billable metric.
- Next to the name in the title, click the pencil icon. The Update Billable Metric Name window opens.
- Enter the new name.
- Click UPDATE.
Delete a billable metric
Delete a billable metric that you no longer need. Zenskar deletes it even when a pricing preset uses it.Prerequisites
- You need a role with the Can Delete Billable Metric and Can Read Billable Metric permissions. See Permissions.
Delete the billable metric
You cannot restore a deleted billable metric. Deleting a billable metric that a pricing preset uses can affect contracts and invoices. Check which pricing presets use it before you delete it.
- Go to Usage > Billable Metrics.
- Open the actions menu of the billable metric. Click Delete.
- In Delete Billable Metric, click DELETE.