Calculated Fields
Last updated
Last updated
Calculated fields enable you to compute fields that do not exist in your current model. That gives you more flexibility for your segmentations.
Let's give an example! When building a specific audience, you may need derived or computed attributes instead of raw data. For instance, if you want to segment users based on their average basket value but don’t have a dedicated column in your Users
table, you need to calculate it by summing each user's total purchase value and dividing it by their number of purchases.
A calculated field is a new attribute that users can create directly in DinMo without modifying their original data source. This feature allows you to generate new fields based on your existing data, making it easier to build advanced audiences and sync enriched customer profiles to your destinations.
We have built a no-code interface to enable you to compute these attributes based on your tables. Once created, calculated fields behave like any other field in the schema, meaning they can be used in audience filters, mappings, and syncs.
Imagine a user wants to sync conversion data to a CRM, but their transactions table does not contain an LTV column but only transactions. Instead of modifying the original table, the user can create a calculated field in DinMo, setting an LTV field that is the sum of all purchases for a given customer.
These fields can then be used as filters on the segment builder and be included in mappings during data sync.
Click on the model for which you wish to compute a calculated field, and go to the Calculated Field tab.
Click on New Calculated Field. You will then have 2 possible options:
Aggregated field: Field aggregating data from a linked model (for example, the sum of all revenues for a given customer).
Formula field: Field obtained after an operation on several existing fields. For example, you can obtain the predicted total LTV by summing the revenues already generated and the predicted additional value.
If you want to calculate an aggregated field, click on the appropriate button. A panel will open where you will need to fill in the following fields:
Related Model: Select the model related to your base model. This should be a model that follows a "Has Many" relationship to your base model. For example, if you are calculating data for a customer, you could relate it to a "Purchases" model that contains the transaction data for each customer.
[Optional] Any filter to the calculation method.
Calculation Type: You will be presented with several calculation options depending on the type of data you want to aggregate. Choose from the following:
Sum: Total of a numeric column (numeric).
Count: Number of records matching specific criteria (any type).
Average: Mean value of a numeric column (numeric).
Minimum: Smallest value in a column (numeric).
Maximum: Largest value in a column (numeric).
Model Field: After selecting the related model and the calculation type, you will see a list of available fields that match the calculation type you selected. Choose the appropriate field that aligns with your calculation needs.
For SUM
, for instance, you need to select which column to sum.
Once you’ve entered all the necessary information, click on Preview and Continue. You will be presented with a summary of your calculated field and Scheduling options. The calculated fields, like activations, can be set up to run on a regular basis or manually.
For the time being, the formula-based calculated field is only available for numeric/decimal fields.
If you want to calculate a formula field, click on the appropriate button. A panel will open where you will need to fill different sections:
The name of your calculated field
The formula of your calculated field. You can use any existing numeric/decimal field, classical mathematical operators (+,-,*,/) and numbers to transcribe your formula.
Once you’ve entered all the necessary information, click on Preview and Save. Your calculated field will be updated automatically each time the field is used (in a preview, when calculating a segment, during activation, etc.).
Once your calculated field is set up, you will be able to preview it directly on the same tab.
Different icons are used depending on whether the calculated field is based on a formula or is aggregated.
You can now use this field as a filter on the segment builder.