Formula Widgets
Formula widgets provide a powerful way to customize your dashboard metrics beyond the default values offered by standard widget types. These widgets can perform mathematical calculations between other widget types such as Lead Acquisition, Engagement, Conversion, and Retention widgets, enabling you to create custom metrics and forecasts tailored to your business needs.
Requirements
- An active SegMetrics account
- At least one dashboard in your account
- For widget references: existing widgets on your dashboard
Creating a Formula Widget
Formula widgets can be added to any dashboard in your SegMetrics account. Follow these steps to create your first formula widget:
- Open your dashboard - Navigate to the dashboard where you want to add the formula widget
- Click + Add Widget - Located in the dashboard interface
- Select Custom Content - From the widget categories menu
- Drag the Custom Formula widget onto your dashboard
- Double-click the widget to open the editor and begin configuration
Configuring Formula Calculations
Once you've created your formula widget, you can configure it to perform mathematical calculations:
Basic Mathematical Operations
Formula widgets support all standard mathematical operations:
- Addition:
+ - Subtraction:
- - Multiplication:
* - Division:
/ - Exponentiation:
^
Simple Calculation Example
To perform a basic calculation like 2 + 2 , simply enter the formula in the widget editor:
2 + 2
The widget will display the result: 4
Using Widget References
Referencing Existing Widgets
If you have other widgets on your dashboard, you can reference their values in your formula calculations. The widget editor displays a list of available widgets with their IDs and names.
Widget Reference Methods
Method 1: Using Widget IDs Reference widgets using the w prefix followed by the widget number:
w778
Method 2: Using the @ Symbol (NEW) You can search for widgets by typing the @ symbol followed by the widget title:
@Total Orders Product A + @Total Orders Product B
This method makes it easier to find and reference specific widgets by their descriptive names rather than remembering widget ID numbers.
Example: Combining Widget Values
To calculate the sum of two product order widgets:
w778 + w779
This formula will add the values from widget 778 and widget 779, displaying the combined total (e.g., 144).
Working with Date Functions
Formula widgets integrate with the Moment.js library, allowing you to perform date-based calculations and create forecasts.
Current Date Function
To display the current date, use:
DATE()
Default format: YYYY-MM-DD (e.g., 2021-09-07)
Custom Date Formatting
To format dates differently, specify the format in parentheses:
DATE("MM-DD-YYYY")
Result: 09-07-2021
Date Calculation Applications
Date functions are particularly useful for:
- Revenue forecasting
- Lead generation projections
- Monthly growth calculations
- Performance trend analysis
As you’ll see, the default date format is: YYYY-MM-DD. To format the date in a different way, insert the preferred format into the parentheses:
Now the date is formatted as MM-DD-YYYY.
The ability to run date based calculations allows you to create forecasts of important metrics such as revenue and new lead growth.
Available Functions and Formulas
Formatting Functions
| Formula | Description |
|---|---|
n([number], [decimal]) |
Format a number, rounding to specified decimal points |
$([number], [decimal]) |
Format as currency with local currency symbol |
PERCENT([number], [decimal]) |
Format as percentage with % symbol |
DIFF([original], [new], [decimal]) |
Calculate percentage change between values |
Mathematical Functions
| Formula | Description |
|---|---|
abs(x) |
Calculate absolute value |
ceil(x) |
Round up to nearest integer |
floor(x) |
Round down to nearest integer |
round(x [, n]) |
Round to nearest integer or n decimal places |
sqrt(x) |
Calculate square root |
cube(x) |
Calculate cube (x³) |
exp(x) |
Calculate exponent |
Statistical Functions
| Formula | Description |
|---|---|
sum(a, b, c, ...) |
Calculate sum of values |
mean(a, b, c, ...) |
Calculate average of values |
median(a, b, c, ...) |
Find median value |
max(a, b, c, ...) |
Find maximum value |
min(a, b, c, ...) |
Find minimum value |
std(a, b, c, ...) |
Calculate standard deviation |
variance(a, b, c, ...) |
Calculate variance |
mad(a, b, c, ...) |
Calculate median absolute deviation |
Text Operations
| Formula | Description |
|---|---|
| (pipe character) |
Concatenate formulas and text together |
Example: n(AD_SPEND * 108.56) \| "円" (Convert dollars to yen with symbol)
Common Examples
Here are practical examples of formula widget applications:
Lead Generation Forecast
n((LEADS / TODAY_DATE) * DAYS_IN_MONTH, 0)
Forecasts monthly lead generation based on current daily rate.
Currency Conversion
n(AD_SPEND * 108.56) | "円"
Converts ad spend from dollars to yen with currency symbol.
Cost Per Acquisition
$(AD_SPEND / NUM_BUYERS)
Calculates the cost to acquire each customer.
Conditional Logic
ROI > 1 ? "YES" : "NO"
Displays "YES" if ROI is positive, "NO" if negative.
Percentage Calculation
n(TAG_LEADS / LEADS) * 100 | "%"
Calculates the percentage of leads with a specific tag.
Differences from Standard Widgets
Formula widgets have several distinguishing characteristics:
Visual Indicators
- Blue bar: Formula widgets display a blue bar on the right side to identify them as calculated widgets
- Loading behavior: Show "N/A" until all referenced widgets have loaded completely
Editing Capabilities
- In-place editing: Double-click any formula widget to edit the formula directly
- Real-time updates: Changes to referenced widgets automatically update formula results
Dependencies
- Load order: Formula widgets wait for their referenced widgets to load before calculating
- Dynamic updates: Results update automatically when underlying data changes
Frequently Asked Questions
Q. How do I reference other widgets in my formula?
A. You can reference other widgets in two ways:
- Using widget IDs: Type
wfollowed by the widget number (e.g.,w778) - Using the @ symbol: Type
@followed by the widget title to search and select widgets by name
Q. Why does my formula widget show "N/A"?
A. Formula widgets display "N/A" when they're waiting for their referenced widgets to finish loading. This is normal behavior and the formula will calculate once all dependencies are loaded.
Q. Can I use formula widgets for forecasting?
A. Yes! Formula widgets are excellent for forecasting. Use date functions like DATE() combined with mathematical operations to create revenue forecasts, lead generation projections, and growth trend analyses.
Q. What mathematical operations are supported?
A. Formula widgets support all standard mathematical operations: addition (+ ), subtraction (- ), multiplication (* ), division (/ ), and exponentiation (^ ). They also include advanced functions for statistics, formatting, and date calculations.
Q. How do I format numbers in my formula results?
A. Use formatting functions to control how numbers appear:
n(number, decimals)for basic number formatting$(number, decimals)for currency formattingPERCENT(number, decimals)for percentage formatting- Use the pipe character
|to add custom text or symbols