Skip to main content

Creating and Managing a Custom Formula

Combine and transform your indicators based on your specific needs.

Melchior Larere avatar
Written by Melchior Larere
Updated over 3 weeks ago

Creating and Managing a Custom Formula

Availability

This feature is:

  • Included in the Enterprise plan

  • Available as a paid add-on for Standard and Advanced plans

If you’d like to activate or try this feature, please contact your Fabriq representative.


Purpose

Custom formulas allow you to perform complex calculations using multiple data sources within Fabriq.
They help you combine and transform your indicators according to your specific operational needs.


Common Use Cases

Here are some practical examples of what you can achieve:

  • Subtracting one indicator from another (e.g., produced parts - rejected parts).

  • Calculating scrap ratios.

  • Computing OEE (Overall Equipment Effectiveness).


Creating a Formula

1. Formula Structure

A formula consists of three main elements:

  • Indicators (IR): the source data you want to use.

  • Operators (OR): + - * / ( )

  • Functions (FN): to enrich and customize calculations (e.g., COALESCE).


2. Input Methods

You have two options to create a formula:

  1. Manual input: type the formula directly.

  2. Guided input (recommended): use the assistance buttons, which automatically insert the correct syntax elements, minimizing errors.

💡 Tip:
For complex formulas, always use guided input to reduce the risk of syntax mistakes.


3. Example Formula

Goal: Calculate the number of good pieces produced.

Data sources:

  • A = total pieces produced

  • B = pieces discarded

Formula:

A - COALESCE(B, 0)

Explanation:

  • If no pieces were discarded and indicator B is empty, the COALESCE function replaces B with 0.

  • Result: A - 0 = A → your indicator stays up to date without needing to manually enter a zero.


Available Functions

COALESCE(IR, Value)

Replaces a null or empty value with the value of your choice.

  • Usage: COALESCE(B, 0) → if B is empty, it is automatically replaced by 0.

  • Use case: prevent calculation issues when certain data sources are incomplete.


Error Handling

Fabriq automatically validates your formula during creation and updates:

  • If there is a syntax error, the formula cannot be saved.

  • Guided input reduces the chance of errors by automatically managing syntax.


Updating a Formula

  • You can edit a formula at any time to add, remove, or adjust data sources.

  • Impact of changes:

    • All historical data is recalculated automatically based on the new formula.

    • Fabriq saves the previous historical data, which can be retrieved upon request.


Retrieving Historical Data

To retrieve data before a formula was modified, please provide the Fabriq Support team with:

  • The URL of the indicator.

  • The date the formula was modified.

  • The user who made the modification.

⚠️ Important:
If any of this information is missing, we cannot process your request.

📂 Format provided: CSV


Quick Reference Table

Element

Example

Operators

+ - * / ( )

Available function

COALESCE(IR, 0)

Formula example

A - COALESCE(B, 0)


FAQ – Frequently Asked Questions

1. Can I revert to a previous version of the formula?

Yes. Simply re-enter the previous formula into the formula field.
Fabriq will automatically recalculate the data based on it.


2. Will I lose historical data if I change a formula?

No. Fabriq always stores historical data.
If needed, you can request an export in CSV format (see section above).


3. Why can’t I save my formula?

Your formula likely contains a syntax error.

  • Double-check that you are using the correct operators and that all parentheses are properly closed.

  • Use guided input to avoid common mistakes.


4. What does the COALESCE function do exactly?

The COALESCE function replaces a null or empty value with a defined default.

Example: COALESCE(B, 0) → if B is empty, it is automatically treated as 0.


5. Can I combine multiple functions in one formula?

Yes, you can mix multiple functions and operators for more complex calculations.
Example:

(A - COALESCE(B, 0)) / C

6. How can I test a formula before applying it to real data?

  • Create a temporary test indicator.

  • Apply the formula using a small dataset.

  • Verify the results before using it in production.


7. What should I do if the results are incorrect?

  • Check the accuracy of your data sources.

  • Simplify the formula and test it step-by-step to identify where the issue lies.

  • If the problem persists, contact Fabriq Support and include:

    • The indicator URL.

    • The exact formula.

    • Examples of expected vs. actual results.


8. Can I import a formula from another indicator or file?

No, formulas must be entered manually or created with guided input.
However, you can copy and paste an existing formula into another indicator.


Best Practices

  • Always use guided input for complex formulas.

  • Start with simple data sets to test your formula.

  • Document complex formulas so that other team members can easily maintain them.

Did this answer your question?