Skip to main content
Matik Help Center home page Help Center
Matik Blog Case Studies
  1. Matik
  2. Building Templates
  3. Dynamic Content

Formulas DC

Formulas are currently in beta. Contact your Technical Account Manager for access.

Formulas dynamic content lets you perform calculations and data transformations directly within Matik — no external spreadsheet or custom SQL needed. Use formulas to compute metrics, format numbers, pivot data, apply conditional logic, and more, all while referencing data from any of your existing dynamic content or inputs.

Because formulas run natively in Matik, they also offer faster generation performance compared to routing transformations through an external data source.

What You Can Do with Formulas

Formulas are designed to help you transform your data into the format you need to present it in your templates. Here are some common use cases:

Calculate metrics from existing data

If you already have {{active_users}} and {{total_seats}} as dynamic content, you can create a formula to compute the adoption rate:

{{active_users}} / {{total_seats}} * 100

Format numbers for presentation

Your data source might return {{revenue}} as a raw number like 1540000. Use a formula to present it in currency format:

FORMAT({{revenue}}, "USD")

This returns $1,540,000.00. You can also format as a percentage, integer, or custom pattern:

FORMAT({{conversion_rate}}, "percent")

Pivot and reshape table data

Suppose {{deals_by_rep}} returns a table of individual deal rows with columns for Rep Name, Quarter, and Deal Amount. You can pivot it into a summary table grouped by rep and broken out by quarter:

PIVOT(SLICE({{deals_by_rep}}, "1:", ":"), 0, 1, 2, "sum")

This slices off the header row first, then pivots using column 0 (Rep Name) as the row grouping, column 1 (Quarter) as the column grouping, and column 2 (Deal Amount) as the value, aggregated by sum.

Apply conditional logic

Return different text based on how a metric compares to a baseline. For example, if {{nps_score}} and &:target_nps are available:

IF({{nps_score}} >= &:target_nps, "On Track", "Needs Attention")

Filter and sort table data

If {{support_tickets}} returns a table with columns for Account, Priority, and Status, you can filter to just the high-priority open tickets and sort by account:

SORT(FILTER(SLICE({{support_tickets}}, "1:", ":"), 1, "=", "High"), 0, "asc")

Referencing Data in Formulas

Formulas work with data from your existing dynamic content and inputs:

  • Dynamic content references use double curly braces: {{dynamic_content_name}}. These pull in the resolved value of another piece of dynamic content — whether it returns text, a number, or a table. Examples: {{revenue}}, {{quarterly_results}}, {{account_name}}.
  • Input references use the ampersand-colon prefix: &:input_name. These pull in the value of an input parameter that the end user provides at generation time. Examples: &:account_name, &:fiscal_year, &:target_quota.

You can use both types together in a single formula. For instance:

IF({{closed_won_amount}} >= &:quarterly_target, "Target Met", "Below Target")

Output Types

Formulas support two output types:

  • Text: Returns a single value — a number, formatted string, or text. Use this for calculated metrics, formatted numbers, conditional labels, or concatenated strings.
  • Table: Returns a table of data (rows and columns). Use this when your formula produces a filtered, pivoted, sorted, or otherwise transformed dataset. When using the Table output type, you can optionally specify comma-separated column headers.

Editing Formulas

You can view and edit your formula in two ways:

  • Formula text: Write or edit the formula directly as text. This is useful for simple formulas or for quick edits to existing ones.
  • Step-by-step builder: A visual editor where each formula function is represented as a node. Nodes can reference each other, making it easy to build and understand complex nested formulas. This view is especially helpful when your formula involves multiple transformation steps.

You can freely switch between either view. You can also use Matik's AI to help you create or edit the Formula.

Working with Tables

Many formula functions operate on table data. Here are some important things to know:

  • Headers are row 0. When a dynamic content reference returns a table, the first row (index 0) typically contains column headers. Most functions like FILTER, PIVOT, COUNTIF, SUMIF, and AVGIF operate on data rows, so you should slice off the header row first using SLICE({{table}}, "1:", ":") before passing the data to these functions.
  • Column indices are 0-based. The first column is 0, the second is 1, and so on. For example, to filter on the third column, use column index 2.
  • You can use SLICE for flexible data access. SLICE supports Python-style indexing: "1:" means "from row 1 onward," ":3" means "up to row 3," "1:5" means "rows 1 through 4," and -1 means "the last row." The same patterns apply to columns.

Was this article helpful?

Have more questions? Submit a request

Articles in this section

  • Using Nested Dynamic Content in SQL Based Dynamic Content
  • Formulas DC
  • Using Metabase with Dynamic Content
  • Using Power BI in Dynamic Content
  • Dynamic Content Overview
  • Using Google Sheets with Matik
  • Connecting Charts to Dynamic Content in Templates
  • Using Gainsight in Dynamic Content
  • Working with Images in Dynamic Content
  • Using Automated Insights Dynamic Content
  • See all articles

Comments

0 comments

Article is closed for comments.

Personalize data-driven content in minutes

Product

  • How it Works
  • Integrations
  • AI Features
  • Security

Solutions

  • Sales
  • Customer Success
  • Ops & Strategy
  • Data

Resources

  • Blog
  • Templates
  • AI + CS Resource Hub
  • Case Studies
  • Help Center

Company

  • About Us
  • Careers
  • Terms of Service
  • Privacy Policy

© 2024 Matik, Inc.