Find a billable metric
Prerequisites
- You need a role with the Can Read Billable Metric permission.
Steps
- Go to Usage > Billable Metrics. The list shows the billable metrics of your organization.
- Optional: To narrow the list, click FILTER. In Filter by…, select Name or Created At. Select a condition and a value, and click APPLY FILTER. The list shows only the billable metrics that match. To remove all filters, click Clear All Filters.
- Optional: To sort the list, click a column header. Click it again to sort in descending order, and a third time to remove the sorting.
- In Search Billable Metric, enter part of the name, and select the billable metric from the results. You can also click the billable metric in the list.
Create a billable metric
Prerequisites
- You need a role with the Can Create Billable Metric and Can Read Billable Metric 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.
Steps
- Go to Usage > Billable Metrics.
- Click ADD NEW BILLABLE METRIC. The Add New Billable Metric screen opens with VISUAL BUILDER selected.
-
Choose the builder:
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.
-
Build the billable metric in the builder that you chose:
- 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 custom attribute 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.
- Optional: Check the result. See Preview a billable metric.
- Click CREATE BILLABLE METRIC. The Choose Billable Metric Name window opens. CREATE BILLABLE METRIC is available on the last step of the visual builder, or in the SQL builder after you click EDIT and confirm.
- Enter the name.
- Click CREATE BILLABLE METRIC.
Preview a billable metric
Run a billable metric for a customer and a period before you save it.Prerequisites
- You need a role with the Can Read Billable Metric permission.
Steps
- 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. The preview runs only when each variable that the query uses has a value, and Billing Period has both dates.
Edit a billable metric
Prerequisites
- You need a role with the Can Update Billable Metric and Can Read Billable Metric permissions.
Steps
- 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.Prerequisites
- You need a role with the Can Update Billable Metric and Can Read Billable Metric permissions.
Steps
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. Zenskar converts the settings of the visual builder into a query. 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
Prerequisites
- You need a role with the Can Update Billable Metric and Can Read Billable Metric permissions.
Steps
- 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
Prerequisites
- You need a role with the Can Delete Billable Metric and Can Read Billable Metric permissions.
Steps
You cannot restore a deleted billable metric. Zenskar deletes it even when a pricing preset uses it, which 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, and click Delete.
- In Delete Billable Metric, click DELETE.