title | keywords | last_updated | sidebar | permalink | |
---|---|---|---|---|---|
|
tbd |
tbd |
mydoc_sidebar |
/:collection/:path.html |
You can add a formula directly within a search. Some common reasons for using a formula in a search are to perform mathematical functions, check for and replace null values, or add conditional logic.
To create a formula in a search:
-
Start a new search, or choose an existing answer from a pinboard to edit.
-
If the answer shows a chart, switch to Data View.
![]({{ site.baseurl }}/images/toggle_between_views.png "Switch to Data View")
-
In the upper right hand side of the table, click Actions and select Add formula.
![]({{ site.baseurl }}/images/create_formula_in_answer.png "Create a new formula in an answer")
-
Type your formula in the Formula Builder.
![]({{ site.baseurl }}/images/formula_builder.png "Use the Formula Builder")
{% include note.html content="Formulas elements are color coded by type and can include the formula operators and functions (blue), the names of columns (purple), and/or constants (black)." %}
-
You can see a list of formula operators with examples by clicking on Formula Assistant.
![]({{ site.baseurl }}/images/formula_assistant.png "Examples in the Formula Assistant")
-
If you want to change what your formula returns, use the Advanced settings.Depending on your formula, you may be able to change:
- Data type
- ATTRIBUTE or MEASURE
- Aggregation type
![]({{ site.baseurl }}/images/formula_advanced_settings.png "Advanced settings in the Formula Builder")
-
Name the formula by clicking on its title and typing the new name. Click Save.
[Formula function reference]({{ site.baseurl }}/reference/formula-reference.html#)