# Formula Widgets

The Custom Dashboard introduces a new type of widget that you can add to your Dashboards: the Formula Widget.

As opposed to standard widgets, which are calculated from your reports, Formula Widgets can be used to use the value from Single Value, Snapshot or other Formula widgets as the basis for your calculations.

This allows you to create customized KPIs and display them alongside your standard report widgets.

## Differences from standard widgets

- Formula widgets always have a blue bar on the right side to denote them as being calculated
- Formula widgets will not load until their related widgets have loaded, showing "N/A" until they are finished loading
- You may double-click a Formula widget to edit the formula in-place:

## Available Functions

You can use the following functions and formulas to modify your values.

In addition, all Formula widgets support standard math functions (+, -, *, /, ^)

Formula | Description |
---|---|

| (pipe character) |
Concatenate different formulas and text together. Useful for adding text before or after a value |

w | Use w (followed by a number) to reference the value of an existing widget. |

n([number], [decimal]) | Format a number, rounding to a number of decimal points |

$([number], [decimal]) | Format a number, rounding to a number of decimal points, and add a dollar sign in front |

abs(x) | Calculate the absolute value of a number. |

ceil(x) | Round a value up |

cube(x) | Compute the cube of a value, `x * x * x` . |

exp(x) | Calculate the exponent of a value. |

floor(x) | Round a value down |

round(x [, n]) | Round a value towards the nearest integer. |

sqrt(x) | Calculate the square root of a value. |

mad(a, b, c, …) | Compute the median absolute deviation of a matrix or a list with values. |

max(a, b, c, …) | Compute the maximum value of a matrix or a list with values. |

mean(a, b, c, …) | Compute the mean value of matrix or a list with values. |

median(a, b, c, …) | Compute the median of a matrix or a list with values. |

min(a, b, c, …) | Compute the minimum value of a matrix or a list of values. |

std(a, b, c, …) | Compute the standard deviation of a matrix or a list with values. |

sum(a, b, c, …) | Compute the sum of a matrix or a list with values. |

variance(a, b, c, …) | Compute the variance of a matrix or a list with values. |

## Common Examples

Formula Example | Description |
---|---|

n(( LEADS / TODAY_DATE ) * DAYS_IN_MONTH, 0) |
Forecast lead generation for the month |

n( AD_SPEND * 108.56) | "円" | Convert Ad Spend from Dollars to Yen |

$(AD_SPEND / NUM_BUYERS) | Calculate Ad Cost per Buyer |

ROI > 1 ? "YES" : "NO" | Print "Yes!" if ROI is positive |

n(TAG_LEADS / LEADS) * 100 | "%" | Calculate percentage of leads who have a tag |