Custom Fields

Custom fields allow admins and contributors to expand the data model by creating fields from existing source columns.

Creating custom fields can provide flexibility and adaptability for specific business calculations. Custom fields allow for new fields to be created to expand on the data fields provided.

Example: Custom fields are great for calculations. See below for a simple calculation.
[custom_field] sales_amount = units_sold * price_per_unit

When to Use Custom Fields?

Use custom fields when you need to add a field that does not exist in the source schema, but would be beneficial to have in the semantic layer to streamline insight generation.

Key Points To Note

Create a Custom Field

Let's walkthrough an example of how to use custom fields to convert the format of a "YYYY-MM-DD" date field into a fiscal-year-week field.

actual_payment_date  --> fiscal_year_week
   '2024-02-01'      -->  '2024-05'

Identify the Source Name of the Field

Use the source name for each of the fields involved in the custom calculation.

Add a Custom Field

To add a custom field, edit the knowledge base and add a field.

Select Custom Field

Select the custom field to open the creation menu.

Input SQL Calculation into Custom Calculation Field

Use the source name for each of the fields involved in the custom calculation. Make sure to use the correct SQL dialect that matches the data source you connected.

to_char(actual_payment_date, 'IYYY-IW')

Add a semantic name and context for the field and press done.

Validate Custom Calculation Field

The custom field is now available to be used in generating insights.

Last updated

Was this helpful?