Digital Marketing

Enhancing Datorama Capabilities: Your Guide to Custom Functions

Datorama's out-of-the-box tools cover most reporting needs, but custom scripts, formula-based metrics, and widget-level expressions unlock a lot more when your data gets complex.

MageshSeptember 9, 20233 min read

Datorama comes with a solid set of built-in tools for shaping and visualizing data, and for most day-to-day reporting that's more than enough. Once requirements get more specific, though, the standard toolkit starts to show its limits.

For those cases, Datorama lets you step outside the defaults with custom scripts, formula-based calculations, and widget-level expressions. Here's how each of these advanced features works and when to reach for them.

Custom Scripts: Data Manipulation on Ingestion

JavaScript in Datorama

Datorama allows you to use JavaScript to write custom scripts that can alter your data as it is ingested into the platform. These scripts can clean, transform, and enrich data according to specific requirements.

Implementation Steps

  • Go to the Data Sources section and select the relevant data source.
  • Click on ‘Advanced Settings’ and then select ‘Custom Scripts.’
  • Write JavaScript code to act on each incoming row of data.

Example

If you have a “Sales Data” column with values in different currencies, you could convert all values to USD with this script:

Calculations: Formula Editor

Using Datorama’s Formula Editor

For simpler calculations, Datorama provides a Formula Editor that enables you to create calculated metrics without coding.

Implementation Steps

  • Go to the Metrics section in the Dashboard.
  • Click on ‘Create New Metric’.
  • Use the Formula Editor to input your calculations.

Example

To create an ROI (Return on Investment) metric, you could use the formula:

Custom Expressions: Real-time Calculations in Widgets

Using SQL-like Expressions

Datorama offers custom expressions that can be used directly within widgets for real-time calculations. The syntax is similar to SQL and supports a range of operations.

Implementation Steps

  • Create or edit a widget.
  • Go to the widget’s settings, under the ‘Data’ tab.
  • Insert your custom expressions in the appropriate fields.

Example

To calculate the average sale per transaction, you can use:

Conclusion

Datorama’s standard features are adequate for basic and moderately complex data manipulation tasks. However, for more specialized needs, custom scripts, calculations, and expressions can be used for further customization. By effectively using these advanced features, you can perform a wider range of data manipulations and calculations in Datorama.

You can increase Datorama’s functionality to meet your unique data analysis needs by becoming proficient with these tools.