---
title: Introducing What-If Formulae
description: Explore What-If Formulae for scenario analysis, MSRP/RRP calculation, cost of goods estimation, and profit margin analysis.
---
import { Aside, Steps,Card  } from '@astrojs/starlight/components';
import { MediaPlayerComponent } from "../../../../components/video-player";
import RunScript from "../../../../components/RunScript.astro";

# Introducing What-If Formulae

<MediaPlayerComponent video="What-if-formulae.mp4"
chapters={[
{ "start": 0, "end": 5, "text": "Click on What-If Formulae under Analysis", "description" : "From the Infoveave menu, click Analysis in the top navigation bar. Select What-If Formulae from the dropdown menu to navigate to the formula section." },
{ "start": 5, "end": 10, "text": "Create a New Formula", "description" : "Click the New Formula button, provide a descriptive name, select the data source and save."},
{ "start": 10, "end": 16, "text": "Define the First Formula Element" , "description" : "Click Add New to define a formula element. Assign a unique Key, provide a Name , select a relevant Measure, and choose appropriate Dimensions. Ensure Value type is Value and then click Save." },
{ "start": 16, "end": 20, "text": "Define the Second Formula Element", "description" : "Click Add New again. Assign a Key, provide a Name, select another relevant Measure, and choose applicable Dimensions. Keep Value type as Value and click Save." },
{ "start": 20, "end": 24, "text": "Define the Third Formula Element" , "description" : "Click Add New. Assign a Key, provide a Name, select a third relevant Measure, and choose applicable Dimensions. Keep Value type as Value and click Save."},
{ "start": 24, "end": 26, "text": "Define a Value-Based Formula Element" , "description" : "Click Add New. Assign a Key, provide a Name, and set an Initial value. Ensure Value type is Value and click Save."},
{ "start": 26, "end": 29, "text": "Define a Calculated Formula Element (Expression 1)" , "description" : "Click Add New. Assign a Key, provide a Name, select Standard for Expression type, and enter a relevant expression using previously defined keys. Click Save."},
{ "start": 29, "end": 32, "text": "Define a Calculated Formula Element (Expression 2)" , "description" : "Click Add New. Assign a Key, provide a Name, select Standard for Expression type, and enter another relevant expression. Click Save."},
{ "start": 32, "end": 35, "text": "Define a Calculated Formula Element (Expression 3)" , "description" : "Click Add New. Assign a Key, provide a Name, select Standard for Expression type, and enter a relevant expression. Click Save."},
{ "start": 35, "end": 41, "text": "Define a Conditional Formula Element" , "description" : "Click Add New. Assign a Key, provide a Name, select Standard for Expression type, and enter a conditional expression based on your analysis needs. Click Save."},

]}
poster="/images/introduction-poster.png"
posterText="What-If Analysis And Formula"
client:load
/>

The What-If Formulae help you explore different scenarios using one or more formulas on measures, expressions, and fixed values. They use the goal-seeking method to provide suggestions. In other words, if you don’t know the input value for an expression but know the desired result, the What-If Formulae suggest inputs to help you achieve it. You can also apply filters to the What-If Formulae based on dimensions available in the Datasource.

## Creating What-If Formulae

<Aside>  
The What-If Formulae you create here are readily available in the [What-If Analysis](/analysis-v8/what-if-analysis-v8/) section for detailed analysis and exploration.  
</Aside>

Steps to create and set up What-If Formulae


<Steps>  
1. To create and set up a What-If Formulae based on the measures and dimensions in the Datasource, click on **Analysis** <i class="fa-duotone fa-regular fa-arrow-right"></i> **What-If Formulae** <i class="fa-duotone fa-regular fa-function"></i>. 

   All What-If Formulae created by you or shared with you appear under the tabs **My What-If Formulae** and **Shared What-If Formulae** respectively.  
![What If Formula](/images/Analysis/What-If-Formulae/Introducing-What-If-Formulae/What-If-Formula.png)  
2. Click on **New Formula** to create a new one.  
3. Enter the formula **Name**.  
4. Select the **Datasource** or **Query** from the respective dropdown list.  
    * **Datasource** Use an existing Datasource to create the formula, allowing access to all predefined measures and dimensions.  
    * **Queries** Use existing related queries that contain measures and dimensions.  
![Select Source Type for What If Formula](/images/Analysis/What-If-Formulae/Introducing-What-If-Formulae/Select-Source-Type-for-What-If-Formula.png)  
5. When you select **Queries** to configure the What-If Formulae, define the required measures and dimensions.  
![Add Query Formula](/images/Analysis/What-If-Formulae/Introducing-What-If-Formulae/Add-Query-Formula-1.png)  
6. Click on **Save** to add the What-If Formulae to Infoveave.  
</Steps>

<Aside>  
To configure What-If Formulae, make sure the corresponding Datasource or query is already set up. To learn more about writing queries in Infoveave, visit [Queries](/studio-v8/queries/query-editor/).  
</Aside>

<Aside type="caution">  
Once the What-If Formulae is saved, you cannot change the Datasource or query. You also cannot rename the What-If Formulae after saving.  
</Aside>


## Identifying and Defining Scenario Elements

Identify and define the key variables involved in your What-If scenario. These variables include the measures and values you want to analyze or adjust as part of your goal-seeking process.

To configure the What-If Formulae in Infoveave, follow these steps  
<Steps>  
1. Click the **Edit** <i class="fa-duotone fa-regular fa-pencil"></i> icon on the newly created Formulae.  
![Configure Formula](/images/Analysis/What-If-Formulae/Introducing-What-If-Formulae/Configure-Formula.png)  
2. A dialog opens where you define **Measures**, **Values**, and **Expressions** for the formula.  
</Steps>

#### Measures

Assign selected measures with unique keys for easy reference. This helps you clearly formulate the scenario.

To configure the **Measure** formula element in Infoveave, follow these steps  
<Steps>  
1. Click the measure icon to add a **Measure**.  
    * **Key** Use alphabets as keys to define each measure. Assign a unique key to each measure.  
    * **Name** Enter a descriptive name for the measure. This is mandatory.  
    * **Measure** Select the relevant measure you want to use in the formula.  
    * **Dimension** Choose the relevant dimension(s) for the measure.  
    * **Value type** Specify if the value is a numeric **Value** or a **Percentage**.  
![What If Formula Measure](/images/Analysis/What-If-Formulae/Introducing-What-If-Formulae/What-If-Formula-Measure.png)  
2. Click **Save** to save the Measure.  
</Steps>

<Aside>  
You must define at least one measure and dimension to save the formula.  
</Aside>

#### Value

A value is a numerical amount or percentage used as a basis to evaluate scenarios and assess impact.

To configure the **Value** element in the What-If Formulae, follow these steps  
<Steps>  
1. Click the value icon to add a **Value**.  
    * **Key** Use alphabets as keys to define each value element.  
    * **Name** Provide a descriptive name. This is mandatory.  
    * **Initial value** Enter the starting value for calculations.  
    * **Value type** Choose whether the input is a **Value** or **Percentage**.  
![What If Formula Value](/images/Analysis/What-If-Formulae/Introducing-What-If-Formulae/What-If-Formula-Value.png)  
2. Click **Save** to add the Value.  
</Steps>


## Defining Expressions

You can configure your scenario formula using **Expressions**, based on your predefined measures and values. The **Copy of value** option helps you create a new variable using the same value as an existing one, saving time and effort.

## Expressions

Expressions let you define goal-seeking formulas using the assigned key variables.

To configure the **Expression** in Infoveave, follow these steps  
<Steps>  
1. Click the expression icon to add an **Expression**.  
    * **Key** Assign a unique key using alphabets.  
    * **Name** Enter a name for the expression element.  
    * **Expression type** Choose from the following:  
      **Standard** Uses Excel-like functions and mathematical formulas. Always returns a numeric value.  
      **JavaScript** Use JavaScript functions or expressions for advanced calculations.  
      **Standard string** Uses Excel-like functions but returns a string. Best for text-based outputs.  
    * **Expression** Enter the logic or formula based on the type selected.  
![What If Formula Expression](/images/Analysis/What-If-Formulae/Introducing-What-If-Formulae/What-If-Formula-Expression.png)  
2. Click **Save** to add the expression.  
</Steps>

<Aside type="tip">  
An expression uses keys from the defined measures. For example, if you define measures with keys `a`, `e`, `g`, and `h`, you can use the formula `(a + g) * (e + h)` in the expression.  
</Aside>

#### Examples with Different Expression Types
<Card title=" Standard expression type">
![standard expression](/images/Analysis/What-If-Formulae/Introducing-What-If-Formulae/standardexpression.png)
**Expression** 

```
a * b
```

**Explanation** 

This multiplies two values.

![standard expression shift](/images/Analysis/What-If-Formulae/Introducing-What-If-Formulae/standard-expression-shidt.png)


Use `Ctrl + Shift` for auto-suggestions while typing.


**Components** 

`a` = Quantity Sold (Measure)  
`b` = Unit Price (Measure)  
`*` = Multiplication operator

The asterisk (*) is the multiplication operator

**Purpose** 

Calculates total sales before discounts using quantity × unit price.  

</Card>

<Card title="JavaScript expression type">

![javascript expression type](/images/Analysis/What-If-Formulae/Introducing-What-If-Formulae/javascript-expression-type.png)

**Expression**

```
@a * @b
```

**Explanation** 

This multiplies two values using JavaScript syntax. 

![javascript](/images/Analysis/What-If-Formulae/Introducing-What-If-Formulae/javascript-shft.png)

Use `Ctrl + Shift` for auto-suggestions while typing.


**Components** 

`@a` = Quantity Sold (Measure)  
`@b` = Unit Price (Measure)



**Purpose** 

Calculates total sales: Quantity Sold × Unit Price  


</Card>

<Card title="Standard String expression type">

![standard string](/images/Analysis/What-If-Formulae/Introducing-What-If-Formulae/standardstring.png)

**Expression**

 ```
a & " " & b
 ```

**Explanation** 

Concatenates two values with a space in between.  

![string](/images/Analysis/What-If-Formulae/Introducing-What-If-Formulae/standardstringexp.png)

**Components** 

`a` = Quantity Valid (Measure)  
`b` = Web Price (Measure)

**Purpose** 

Combines both values into a single string like `"100 25"` 

Example output:

If a = 100 and b = 25, the result is "100 25"

</Card>

## Copy of value

The **Copy of value** feature creates a new variable with the same value as an existing one. It saves time by eliminating the need to re-enter values.

To configure the **Copy of value** formula element, follow these steps  
<Steps>  
1. Click the **Copy of value** icon.  
    * **Key** Assign a unique key using alphabets.  
    * **Name** Provide a name describing the purpose.  
    * **Value** Select the key from which to copy the value.  
![What If Formula Copy of value](/images/Analysis/What-If-Formulae/Introducing-What-If-Formulae/What-If-Formula-Copy-of-Value.png)  
2. Click **Save** to add it to the formula.  
</Steps>

