

# Creating autonarratives with Amazon Quick Sight
Autonarratives

An *autonarrative *is a natural-language summary widget that displays descriptive text instead of charts. You can embed these widgets throughout your analysis to highlight key insights and callouts. You don't have to sift through the visual, drilling down, comparing values, and rechecking ideas to extract a conclusion. You also don't have to try to understand what the data means, or discuss different interpretations with your colleagues. Instead, you can extrapolate the conclusion from the data, and display it in the analysis, stated plainly. A single interpretation can be shared by everyone.

Amazon Quick Sight automatically interprets the charts and tables in your dashboard and provides a number of suggested insights in natural language. The suggested insights that you can choose from are ready-made and come with words, calculations, and functions. But you can change them if you want to. You can also design your own. As the author of the dashboard, you have complete flexibility to customize the computations and language for your needs. You can use narratives to effectively tell the story of your data in plain language.

**Note**  
Narratives are separate from machine learning. They only use ML if you add forecast or anomaly (outlier) computations to them.

**Topics**
+ [

# Insights that include autonarratives
](auto-narratives.md)
+ [

# Use the narrative expression editor
](using-narratives-expression-editor-step-by-step.md)
+ [

# The expression editor workspace
](using-narratives-expression-editor-menus.md)
+ [

# Adding URLs
](using-narratives-expression-editor-urls.md)
+ [

# Working with autonarrative computations
](auto-narrative-computations.md)

# Insights that include autonarratives


When you are adding an insight, also known as an autonarrative, to your analysis, you can choose from the following templates. In the following list, they are defined by example. Each definition includes a list of the minimum required fields for the autonarrative to work. If you are using only the suggested insights on the **Insights** tab, choose the appropriate fields to get an insight to show up in the suggested insights list.

For more information on customizing autonarratives, see [Working with autonarrative computations](auto-narrative-computations.md).
+ **Bottom ranked** – For example, the bottom three states by sales revenue. Requires that you have at least one dimension in the **Categories** field well. 
+ **Bottom movers** – For example, the bottom three products sold, by sales revenue. Requires that you have at least one dimension in the **Time** field well and at least one dimension in the **Categories** field well. 
+ **Forecast** *(ML-powered insight) *– For example, "Total sales are forecasted to be \$158,613 for Jan 2016." Requires that you have at least one dimension in the **Time** field well. 
+ **Growth rate** – For example, "The 3-month compounded growth rate for sales is 22.23%." Requires that you have at least one dimension in the **Time** field well. 
+ **Maximum** – For example, "Highest month is Nov 2014 with sales of \$1112,326." Requires that you have at least one dimension in the **Time** field well. 
+ **Metric comparison** – For example, "Total sales for Dec 2014 is \$190,474, 10% higher than target of \$181,426." Requires that you have at least one dimension in the **Time** field well and at least two measures in the **Values** field well. 
+ **Minimum** – For example, "Lowest month is Feb 2011 with sales of \$14,810." Requires that you have at least one dimension in the **Time** field well. 
+ **Anomaly detection** *(ML-powered insight)* – For example, top three outliers and their contributing drivers for total sales on January 3, 2019. Requires that you have at least one dimension in the **Time** field well, at least one measure in the **Values** field well, and at least one dimension in the **Categories** field well. 
+ **Period over period** – For example, "Total sales for Nov 2014 increased by 44.39% (\$134,532) from \$177,793 to \$1112,326." Requires that you have at least one dimension in the **Time** field well. 
+ **Period to date** – For example, "Year-to-date sales for Nov 30, 2014 increased by 25.87% (\$1132,236) from \$1511,236 to \$1643,472." Requires that you have at least one dimension in the **Time** field well. 
+ **Top ranked** – For example, top three states by sales revenue. Requires that you have at least one dimension in the **Categories** field well. 
+ **Top movers** – For example, top products by sales revenue for November 2014. Requires that you have at least one dimension in the **Time** field well and at least one dimension in the **Categories** field well. 
+ **Total aggregation** – For example, "Total revenue is \$12,297,200." Requires that you have at least one dimension in the **Time** field well and at least one measure in the **Values** field well. 
+ **Unique values** – For example, "There are 793 unique values in `Customer_IDs`." Requires that you have at least one dimension in the **Categories** field well. 

# Use the narrative expression editor


The following walkthrough shows an example of how to customize a narrative. For this example, we use a period over period computation type.

1. Begin with an existing analysis. Add a **period over period** insight to it. The easiest way to do this is to choose the \$1 icon, then **Add insight**, then choose a type of insight from the list. To learn what type of computational insights you can add as autonarratives, see [Insights that include autonarratives](auto-narratives.md).

   After you choose a type of insight, choose **Select** to create the widget. To create an empty narrative, close this screen without choosing a template. To follow this example, choose **Period over period**.

   If you had a visual selected when you added the insight, the field wells have preconfigured fields for the date, metric, and category. These come from the visualization that you chose when you created the insight. You can customize the fields as needed.

   You can only customize a narrative for a new or existing insight (text-based) widget. You can't add one to an existing visual (chart based), because it's a different type of widget. 

1. Edit the narrative in the expressions editor by choosing the on-visual menu, then choosing **Customize narrative**.

   In this context, **Computations** are predefined calculations (period-over-period, period-to-date, growth rate, max, min, top movers, and so on) that you can reference in your template to describe your data. Currently, Amazon Quick Sight supports 13 different types of computations that you can add to your insight. In this example, **PeriodOverPeriod** is added by default because we chose the **Period Over Period** template from the suggested insights panel. 

1. Choose **Add computation** at bottom right to add a new computation, and then choose one from the list. For this walkthrough, choose **Growth rate**, and then choose **Next**.

1. Configure the computation by choosing the number of periods that you want to compute over. The default is four, and that works for our example. Optionally, you can change the name of the computation at the top of the screen. However, for our purposes, leave the name unchanged.
**Note**  
The computation names that you create are unique within the insight. You can reference multiple computations of the same type in your narrative template. For example, suppose that you have two metrics, sales revenue and units sold. You can create growth rate computations for each metric if they have different names.   
However, anomaly computations aren't compatible with any other computation type in the same widget. Anomaly detection must exist in an insight by itself. To use other computations in the same analysis, put them into insights separate from anomalies.

   To proceed, choose **Add**.

1. Expand **Computations** on the right. The computations that are part of the narrative display in the list. In this case, it's **PeriodOverPeriod** and **GrowthRate**. 

1. In the workspace, add the following text after the final period: **Compounded growth rate for the last**, then add a space.

1. Next, to add the computation leave your cursor after the space after the word **last**. On the right, under **GrowthRate**, choose the expression named **timePeriods** (click only once to add it). 

   Doing this inserts the expression **GrowthRate.timePeriods**, which is the number of periods you set in the configuration for **GrowthRate**. 

1. Complete the sentence with ** days is ** (a space before and afterwards), and add the expression **GrowthRate.compoundedGrowthRate.formattedValue**, followed by a period (`.`). Choose the expression from the list, rather than typing it in. However, you can edit the contents of the expression after you add it.  
![\[Expression editor with open expressions list.\]](http://docs.aws.amazon.com/quick/latest/userguide/images/narrative-add-expression.png)
**Note**  
The **formattedValue** expression returns a string that is formatted based on the formatting applied for the metric on the field. To perform metric math, use **value** instead, which returns the raw value as an integer or decimal.

1. Add a conditional statement and formatting. Place your cursor at the end of the template, after the `formattedValue` expression. Add a space if necessary. On the **Edit narrative** menu bar, choose **Insert code**, and then choose **Inline IF** from the list. An expression block opens.

1. With the expression block open, choose **GrowthRate**, **compoundedGrowthRate**, **value** from the expression list. Enter **>0** at the end of the expression. Choose **Save**. Don't move your cursor yet.

   A prompt appears for the conditional content; enter **better than expected\$1** Then select the text you just entered, and use the formatting toolbar at the top to turn it green and bold.

1. Add another expression block for the case when the growth rate wasn't that great by repeating the previous step. But this time, make it **<0** and enter the text **worse than expected**. Make it red instead of green. 

1. Choose **Save**. The customized narrative that we just created should look similar to the following.  
![\[Customized narrative.\]](http://docs.aws.amazon.com/quick/latest/userguide/images/narrative-example-result.png)

The expression editor provides you with a sophisticated tool to customize your narratives. You can also reference the parameters you create for your analysis or dashboard, and use a set of built-in functions for further customization.

**Tip**  
To create an empty narrative, add an insight using the **\$1** icon and then **Add insights**. But instead of choosing a template, simply close the screen.   
The best way to get started with customizing narratives is to use the existing templates to learn the syntax.

# The expression editor workspace


Use the expression editor to customize a narrative to best fit your business needs. The information below provides an overview of the expression editor workspace and lists all menu options that can be configured for your narrative. For a walkthrough that shows you how to create a custom narrative, see [Use the narrative expression editor](using-narratives-expression-editor-step-by-step.md).

On the right side of the screen, there's a list of items that you can add to the narrative:
+ **Computations** – Use this to choose from the computations that are available in this insight. You can expand this list.
+ **Parameters** – Use this to choose from the parameters that exist in your analysis. You can expand this list.
+ **Functions** – Use this to choose from functions that you can add to a narrative. You can expand this list.
+ **Add computation** – Use this button to create another computation. New computations appear in the **Computations** list, ready to add to the insight.

At the bottom of the narrative expression editor, there's a preview of the narrative that updates as you work. This area also shows an alert if you introduce an error into the narrative or if the narrative is empty. To see a preview of ML-powered insights like anomaly detection or forecasting, run your insight calculation at least once before customizing the narrative. 

Editing tools are located across the top of the screen. They offer the following options:
+ **Insert code** – You can insert the following code blocks from this menu:
  + **Expressions** – Add a free-form expression. 
  + **Inline IF** – Add an IF statement that displays inline with the existing block of text. 
  + **Inline FOR** – Add a FOR statement that displays inline with the existing block of text.
  + **Block IF** – Add an IF statement that displays in a separate block of text. 
  + **Block FOR** – Add a FOR statement that displays in a separate block of text. 

  The IF and FOR statements enable you to create content that is conditionally formatted. For example, you might add a **block IF** statement, then configure it to compare an integer to a value from a calculation. To do this, you use the following steps, also demonstrated in [Use the narrative expression editor](using-narratives-expression-editor-step-by-step.md):

  1. Open the calculations menu at right, and choose one of the blue highlighted items from one of the calculations. Doing this adds the item to the narrative.

  1. Click once on the item to open it.

  1. Enter the comparison that you want to make. The expression looks something like this: `PeriodOverPeriod.currentMetricValue.value>0`. 

  1. Save this expression in the pop-up editor, which prompts you for **Conditional content**. 

  1. Enter what you want to display in the insight, and format it as you want it to appear. Or if you prefer, you can add an image or a URL—or add a URL to an image.
+ **Paragraph** – This menu offers options for changes to the font size:
  + **H1 Large header**
  + H2 Header
  + H3 Small header
  + ¶1 Large paragraph
  + ¶2 Paragraph
  + ¶3 Small paragraph
+ **Font** – Use this menu tray to choose options for text formatting. These include bold, italic, underline, strikethrough, foreground color of the text (the letters themselves), and background color of the text. Choose the icon to turn on an option; choose it again to toggle the option off.
+ **Formatting** – Use this menu tray to choose options for paragraph formatting, including bulleted list, left justify, center, and right justify. Choose the icon to turn on an option, choose it again to toggle the option off.
+ **Image** – Use this icon add an image URL. The image displays in your insight, provided the link is accessible. You can resize images. To display an image based on a condition, put the image inside an IF block.
+ **URL** – Use this icon to add a static or dynamic URL. You can also add URLs to images. For example, you can add traffic light indicator images to an insight for an executive dashboard, with links to a new sheet for red, amber, and green conditions.

# Adding URLs


Using the **URL** button on the editing menu of the narrative expression editor, you can add static and dynamic URLs (hyperlinks) into a narrative. You can also use the following keyboard shortcuts: ⌘\$1⇧\$1L or Ctrl\$1⇧\$1L. 

A static URL is a link that doesn’t change; it always opens the same URL. A dynamic URL is a link that changes based on the expressions or parameters that you provide when you set it up. It's built with dynamically evaluated expressions or parameters. 

Following are of examples of when you might add a static link in your narrative: 
+ **In an IF statement, you might use the URL in the conditional content.** If you do and a metric fails to meet an expected value, your link might send the user to a wiki with a list of best practices to improve the metric. 
+ **You might use a static URL to create a link to another sheet in the same dashboard, by using the following steps:**

  1. Go to the sheet that you want to make the link to.

  1. Copy that sheet's URL.

  1. Return to the narrative editor and create a link using the URL that you just copied.

Following are examples of when you might add a dynamic link in your narrative: 
+ **To search a website with a query, by using the following steps.**

  1. Create a URL with the following link.

     ```
     https://google.com?q=<<formatDate(now(),'yyyy-MM-dd')>>
     ```

     This link sends a query to Google with search text that is the evaluated value of the following.

     ```
     formatDate(now(), 'yyyy-MM-dd')
     ```

     If the value of `now()` is `02/02/2020`, then the link on your narrative contains `https://google.com?q=2020-02-02`.
+ **To create a link that updates a parameter.** To do this, create or edit a link and set the URL to the current dashboard or analysis URL. Then add the expression that sets the parameter value to at the end, for example `#p.myParameter=12345`. 

  Suppose that the following is the dashboard link that you start with.

  ```
  https://us-east-1.quicksight.aws.amazon.com/sn/analyses/00000000-1111-2222-3333-44444444
  ```

  If you add a parameter value assignment to it, it looks like the following.

  ```
  https://us-east-1.quicksight.aws.amazon.com/sn/analyses/00000000-1111-2222-3333-44444444#p.myParameter=12345
  ```

  For more information on parameters in URLs, see [Using parameters in a URL](parameters-in-a-url.md).

# Working with autonarrative computations
Computations

Use this section to help you understand what functions are available to you when you are customizing an autonarrative. You only need to customize a narrative if you want to change or build on the default computation.

After you create an autonarrative, the expression editor opens. You can also activate the expression editor by choosing the on-visual menu, and then **Customize Narrative**. To add a computation while using the expression editor, choose **\$1 Add computation**.

You can use the following code expression to build your autonarrative. These are available from the list that's labeled **Insert code**. Code statements can display inline (in a sentence) or as a block (in a list).
+ Expression – Create your own code expression.
+ IF – An IF statement that includes an expression after evaluating a condition. 
+ FOR – A FOR statement that loops through values. 

You can use the following computations to build your autonarrative. You can use the expression editor without editing any syntax, but you can also customize it if you want to. To interact with the syntax, open the computational widget in the autonarrative expression editor.

**Topics**
+ [

# ML-powered anomaly detection for outliers
](anomaly-detection-function.md)
+ [

# Bottom movers computation
](bottom-movers-function.md)
+ [

# Bottom ranked computation
](bottom-ranked-function.md)
+ [

# ML-powered forecasting
](forecast-function.md)
+ [

# Growth rate computation
](growth-rate-function.md)
+ [

# Maximum computation
](maximum-function.md)
+ [

# Metric comparison computation
](metric-comparison-function.md)
+ [

# Minimum computation
](minimum-function.md)
+ [

# Period over period computation
](period-over-period-function.md)
+ [

# Period to date computation
](period-to-date-function.md)
+ [

# Top movers computation
](top-movers-function.md)
+ [

# Top ranked computation
](top-ranked-function.md)
+ [

# Total aggregation computation
](total-aggregation-function.md)
+ [

# Unique values computation
](unique-values-function.md)

# ML-powered anomaly detection for outliers
Anomaly detection for outliers

The ML-powered anomaly detection computation searches your data for outliers. For example, you can detect the top three outliers for total sales on January 3, 2019. If you enable contribution analysis, you can also detect the key drivers for each outlier. 

To use this function, you need at least one dimension in the **Time** field well, at least one measure in the **Values** field well, and at least one dimension in the **Categories** field well. The configuration screen provides an option to analyze the contribution of other fields as key drivers, even if those fields aren't in the field wells.

For more information, see [Detecting outliers with ML-powered anomaly detection](anomaly-detection.md).

**Note**  
You can't add ML-powered anomaly detection to another computation, and you can't add another computation to an anomaly detection.

## Computation outputs


Each function generates a set of output parameters. You can add these outputs to the autonarrative to customize what it displays. You can also add your own custom text. 

To locate the output parameters, open the **Computations** tab on the right, and locate the computation that you want to use. The names of the computations come from the name that you provide when you create the insight. Choose the output parameter by clicking on it only once. If you click twice, you add the same output twice. You can use items displayed in **`bold monospace font`** following in the narrative. 
+ `timeField` – From the **Time** field well.
  + `name` – The formatted display name of the field.
  + `timeGranularity` – The time field granularity (**DAY**, **YEAR**, and so on).
+ `categoryFields` – From the **Categories** field well.
  + `name` – The formatted display name of the field.
+ `metricField` – From the **Values** field well.
  + `name` – The formatted display name of the field.
  + `aggregationFunction` – The aggregation used for the metric (**SUM**, **AVG**, and so on).
+ `itemsCount` – The number of items included in this computation.
+ `items` – Anomalous items.
  + `timeValue` – The values in the date dimension.
    + `value` – The date/time field at the point of the anomaly (outlier).
    + `formattedValue` – The formatted value in the date/time field at the point of the anomaly.
  + `categoryName` – The actual name of the category (cat1, cat2, and so on).
  + `direction` – The direction on the x-axis or y-axis that's identified as anomalous: `HIGH` or `LOW`. `HIGH` means "higher than expected." `LOW` means "lower than expected." 

    When iterating on items, `AnomalyDetection.items[index].direction` can contain either `HIGH` or `LOW`. For example, `AnomalyDetection.items[index].direction='HIGH'` or `AnomalyDetection.items[index].direction=LOW`. `AnomalyDetection.direction` can have an empty string for `ALL`. An example is `AnomalyDetection.direction=''`. 
  + `actualValue` – The metric's actual value at the point of the anomaly or outlier.
    + `value` – The raw value.
    + `formattedValue` – The value formatted by the metric field.
    + `formattedAbsoluteValue` – The absolute value formatted by the metric field.
  + `expectedValue` – The metric's expected value at the point of the anomaly (outlier).
    + `value` – The raw value.
    + `formattedValue` – The value formatted by the metric field.
    + `formattedAbsoluteValue` – The absolute value formatted by the metric field.

# Bottom movers computation


The bottom movers computation counts the requested number of categories by date that rank in the bottom of the autonarrative's dataset. For example, you can create a computation to find the bottom three products sold, by sales revenue.

To use this function, at least one dimension in the **Time** field well and at least one dimension in the **Categories** field well. 

## Parameters


*name*   
A unique descriptive name that you assign or change. A name is assigned if you don't create your own. You can edit this later.

*Date*   
The date dimension that you want to rank.

*Category*   
The category dimension that you want to rank.

*Value*   
The aggregated measure that the computation is based on.

*Number of movers*   
The number of ranked results that you want to display.

*Order by*   
The order that you want to use, percent difference or absolute difference.

## Computation outputs


Each function generates a set of output parameters. You can add these outputs to the autonarrative to customize what it displays. You can also add your own custom text. 

To locate the output parameters, open the **Computations** tab on the right, and locate the computation that you want to use. The names of the computations come from the name you provide when you create the insight. Choose the output parameter by clicking on it only once. If you click twice, you add the same output twice. Items displayed in **bold** can be used in the narrative. 

**Note**  
These are the same output parameters as the ones that are returned by the top movers computation.
+ `timeField` – From the **Time** field well.
  + `name` – The formatted display name of the field.
  + `timeGranularity` – The time field granularity (**DAY**, **YEAR**, and so on).
+ `categoryField` – From the **Categories** field well.
  + `name` – The formatted display name of the field.
+ `metricField` – From the **Values** field well.
  + `name` – The formatted display name of the field.
  + `aggregationFunction` – The aggregation used for the metric (**SUM**, **AVG**, and so on).
+ `startTimeValue` – The value in the date dimension.
  + `value` – The raw value.
  + `formattedValue` – The value formatted by the datetime field.
+ `endTimeValue` – The value in the date dimension.
  + `value` – The raw value.
  + `formattedValue` – The absolute value formatted by the datetime field.
+ `itemsCount` – The number of items included in this computation.
+ `items`: Bottom moving items.
  + `categoryField` – The category field.
    + `value` – The value (contents) of the category field.
    + `formattedValue` – The formatted value (contents) of the category field. If the field is null, this displays '`NULL`'. If the field is empty, it displays '`(empty)`'.
  + `currentMetricValue` – The current value for the metric field.
    + `value` – The raw value.
    + `formattedValue` – The value formatted by the metric field
    + `formattedAbsoluteValue` – The absolute value formatted by the metric field.
  + `previousMetricValue` – The previous value for the metric field.
    + `value` – The raw value.
    + `formattedValue` – The value formatted by the metric field
    + `formattedAbsoluteValue` – The absolute value formatted by the metric field.
  + `percentDifference` – The percent difference between the current and previous values of the metric field.
    + `value` – The raw value of the calculation of the percent difference.
    + `formattedValue` – The formatted value of the percent difference (for example, -42%).
    + `formattedAbsoluteValue` – The formatted absolute value of the percent difference (for example, 42%).
  + `absoluteDifference` – The absolute difference between the current and previous values of the metric field.
    + `value` – The raw value of the calculation of the absolute difference.
    + `formattedValue` – The absolute difference formatted by the settings in the metric field's format preferences.
    + `formattedAbsoluteValue` – The absolute value of the difference formatted by the metric field.

# Bottom ranked computation


The bottom ranked computation calculates the requested number of categories by value that rank in the bottom of the autonarrative's dataset. For example, you can create a computation to find the bottom three states by sales revenue.

To use this function, you need at least one dimension in the **Categories** field well. 

## Parameters


*name*   
A unique descriptive name that you assign or change. A name is assigned if you don't create your own. You can edit this later.

*Category*   
The category dimension that you want to rank.

*Value*   
The aggregated measure that the computation is based on.

*Number of results*   
The number of ranked results that you want to display.

## Computation outputs


Each function generates a set of output parameters. You can add these outputs to the autonarrative to customize what it displays. You can also add your own custom text. 

To locate the output parameters, open the **Computations** tab on the right, and locate the computation that you want to use. The names of the computations come from the name you provide when you create the insight. Choose the output parameter by clicking on it only once. If you click twice, you add the same output twice. Items displayed in **bold** can be used in the narrative. 

**Note**  
These are the same output parameters as the ones that are returned by the top ranked computation.
+ `categoryField` – From the **Categories** field well.
  + `name` – The formatted display name of the field.
+ `metricField` – From the **Values** field well.
  + `name` – The formatted display name of the field.
  + `aggregationFunction` – The aggregation used for the metric (**SUM**, **AVG**, and so on).
+ `itemsCount` – The number of items included in this computation.
+ `items`: Bottom ranked items.
  + `categoryField` – The category field.
    + `value` – The value (contents) of the category field.
    + `formattedValue` – The formatted value (contents) of the category field. If the field is null, this displays '`NULL`'. If the field is empty, it displays '`(empty)`'.
  + `metricValue` – The metric field.
    + `value` – The raw value.
    + `formattedValue` – The value formatted by the metric field.
    + `formattedAbsoluteValue` – The absolute value formatted by the metric field.

## Example


The following screenshot shows the default configuration for the bottom-ranked computation.

![\[Default configuration for the bottom-ranked computation.\]](http://docs.aws.amazon.com/quick/latest/userguide/images/bottom-ranked-computation.png)


# ML-powered forecasting
Forecasting

The ML-powered forecast computation forecasts future metrics based on patterns of previous metrics by seasonality. For example, you can create a computation to forecast total revenue for the next six months.

To use this function, you need at least one dimension in the **Time** field well. 

For more information about working with forecasts, see [Forecasting and creating what-if scenarios with Amazon Quick Sight](forecasts-and-whatifs.md).

## Parameters


*name*   
A unique descriptive name that you assign or change. A name is assigned if you don't create your own. You can edit this later.

*Date*   
The date dimension that you want to rank.

*Value*   
The aggregated measure that the computation is based on.

*Periods forward*   
The number of time periods in the future that you want to forecast. Ranges from 1 to 1,000.

*Periods backward*   
The number of time periods in the past that you want to base your forecast on. Ranges from 0 to 1,000.

*Seasonality*   
The number of seasons included in the calendar year. The default setting, **automatic** detects this for you. Ranges from 1 to 180.

## Computation outputs


Each function generates a set of output parameters. You can add these outputs to the autonarrative to customize what it displays. You can also add your own custom text. 

To locate the output parameters, open the **Computations** tab on the right, and locate the computation that you want to use. The names of the computations come from the name you provide when you create the insight. Choose the output parameter by clicking on it only once. If you click twice, you add the same output twice. Items displayed in **bold** can be used in the narrative. 
+ `timeField` – From the **Time** field well.
  + `name` – The formatted display name of the field.
  + `timeGranularity` – The time field granularity (**DAY**, **YEAR**, and so on).
+ `metricField` – From the **Values** field well.
  + `name` – The formatted display name of the field.
  + `aggregationFunction` – The aggregation used for the metric (**SUM**, **AVG**, and so on).
+ `metricValue` – The value in the metric dimension.
  + `value` – The raw value.
  + `formattedValue` – The value formatted by the metric field.
  + `formattedAbsoluteValue` – The absolute value formatted by the metric field.
+ `timeValue` – The value in the date dimension.
  + `value` – The raw value.
  + `formattedValue` – The value formatted by the date field.
+ `relativePeriodsToForecast` – The relative number of periods between latest datetime record and last forecast record.

# Growth rate computation


The growth rate computation compares values over time periods. For example, you can create a computation to find the three-month compounded growth rate for sales, expressed as a percentage.

To use this function, you need at least one dimension in the **Time** field well. 

## Parameters


*name*   
A unique descriptive name that you assign or change. A name is assigned if you don't create your own. You can edit this later.

*Date*   
The date dimension that you want to rank.

*Value*   
The aggregated measure that the computation is based on.

*Number of periods*   
The number of time periods in the future that you want to use to compute the growth rate.

## Computation outputs


Each function generates a set of output parameters. You can add these outputs to the autonarrative to customize what it displays. You can also add your own custom text. 

To locate the output parameters, open the **Computations** tab on the right, and locate the computation that you want to use. The names of the computations come from the name you provide when you create the insight. Choose the output parameter by clicking on it only once. If you click twice, you add the same output twice. Items displayed in **bold** can be used in the narrative. 
+ `timeField` – From the **Time** field well.
  + `name` – The formatted display name of the field.
  + `timeGranularity` – The time field granularity (**DAY**, **YEAR**, and so on).
+ `metricField` – From the **Values** field well.
  + `name` – The formatted display name of the field.
  + `aggregationFunction` – The aggregation used for the metric (**SUM**, **AVG**, and so on).
+ `previousMetricValue` – The previous value in the metric dimension.
  + `value` – The raw value.
  + `formattedValue` – The value formatted by the metric field.
  + `formattedAbsoluteValue` – The absolute value formatted by the metric field.
+ `previousTimeValue` – The previous value in the datetime dimension.
  + `value` – The raw value.
  + `formattedValue` – The value formatted by the datetime field.
+ `compoundedGrowthRate` – The percent difference between the current and previous values of the metric field.
  + `value` – The raw value of the calculation of the percent difference.
  + `formattedValue` – The formatted value of the percent difference (for example, -42%).
  + `formattedAbsoluteValue` – The formatted absolute value of the percent difference (for example, 42%).
+ `absoluteDifference` – The absolute difference between the current and previous values of the metric field.
  + `value` – The raw value of the calculation of the absolute difference.
  + `formattedValue` – The absolute difference formatted by the settings in the metric field's format preferences.
  + `formattedAbsoluteValue` – The absolute value of the difference formatted by the metric field.

# Maximum computation


The maximum computation finds the maximum dimension by value. For example, you can create a computation to find the month with the highest revenue. 

To use this function, you need at least one dimension in the **Time** field well. 

## Parameters


*name*   
A unique descriptive name that you assign or change. A name is assigned if you don't create your own. You can edit this later.

*Date*   
The date dimension that you want to rank.

*Value*   
The aggregated measure that the computation is based on.

## Computation outputs


Each function generates a set of output parameters. You can add these outputs to the autonarrative to customize what it displays. You can also add your own custom text. 

To locate the output parameters, open the **Computations** tab on the right, and locate the computation that you want to use. The names of the computations come from the name you provide when you create the insight. Choose the output parameter by clicking on it only once. If you click twice, you add the same output twice. Items displayed in **bold** can be used in the narrative. 

**Note**  
These are the same output parameters as the ones that are returned by the minimum computation.
+ `timeField` – From the **Time** field well.
  + `name` – The formatted display name of the field.
  + `timeGranularity` – The time field granularity (**DAY**, **YEAR**, and so on).
+ `metricField` – From the **Values** field well.
  + `name` – The formatted display name of the field.
  + `aggregationFunction` – The aggregation used for the metric (**SUM**, **AVG**, and so on).
+ `metricValue` – The value in the metric dimension.
  + `value` – The raw value.
  + `formattedValue` – The value formatted by the metric field.
  + `formattedAbsoluteValue` – The absolute value formatted by the metric field.
+ `timeValue` – The value in the datetime dimension.
  + `value` – The raw value.
  + `formattedValue` – The value formatted by the datetime field.

# Metric comparison computation


The metric comparison computation compares values in different measures. For example, you can create a computation to compare two values, such as actual sales compared to sales goals. 

To use this function, you need at least one dimension in the **Time** field well and at least two measures in the **Values** field well. 

## Parameters


*name*   
A unique descriptive name that you assign or change. A name is assigned if you don't create your own. You can edit this later.

*Date*   
The date dimension that you want to rank.

*Value*   
The aggregated measure that the computation is based on.

*Target value*   
The field that you want to compare to the value.

## Computation outputs


Each function generates a set of output parameters. You can add these outputs to the autonarrative to customize what it displays. You can also add your own custom text. 

To locate the output parameters, open the **Computations** tab on the right, and locate the computation that you want to use. The names of the computations come from the name you provide when you create the insight. Choose the output parameter by clicking on it only once. If you click twice, you add the same output twice. Items displayed in **bold** can be used in the narrative. 
+ `timeField` – From the **Time** field well.
  + `name` – The formatted display name of the field.
  + `timeGranularity` – The time field granularity (**DAY**, **YEAR**, and so on).
+ `fromMetricField` – From the **Values** field well.
  + `name` – The formatted display name of the field.
  + `aggregationFunction` – The aggregation used for the metric (**SUM**, **AVG**, and so on).
+ `fromMetricValue` – The value in the metric dimension.
  + `value` – The raw value.
  + `formattedValue` – The value formatted by the metric field.
  + `formattedAbsoluteValue` – The absolute value formatted by the metric field.
+ `toMetricField` – From the **Values** field well.
  + `name` – The formatted display name of the field.
  + `aggregationFunction` – The aggregation used for the metric (**SUM**, **AVG**, and so on).
+ `toMetricValue` – The current value in the metric dimension.
  + `value` – The raw value.
  + `formattedValue` – The value formatted by the metric field.
  + `formattedAbsoluteValue` – The absolute value formatted by the metric field.
+ `timeValue` – The value in the datetime dimension.
  + `value` – The raw value.
  + `formattedValue` – The value formatted by the datetime field.
+ `percentDifference` – The percent difference between the current and previous values of the metric field.
  + `value` – The raw value of the calculation of the percent difference.
  + `formattedValue` – The formatted value of the percent difference (for example, -42%).
  + `formattedAbsoluteValue` – The formatted absolute value of the percent difference (for example, 42%).
+ `absoluteDifference` – The absolute difference between the current and previous values of the metric field.
  + `value` – The raw value of the calculation of the absolute difference.
  + `formattedValue` – The absolute difference formatted by the settings in the metric field's format preferences.
  + `formattedAbsoluteValue` – The absolute value of the difference formatted by the metric field.

# Minimum computation


The minimum computation finds the minimum dimension by value. For example, you can create a computation to find the month with the lowest revenue. 

To use this function, you need at least one dimension in the **Time** field well. 

## Parameters


*name*   
A unique descriptive name that you assign or change. A name is assigned if you don't create your own. You can edit this later.

*Date*   
The date dimension that you want to rank.

*Value*   
The aggregated measure that the computation is based on.

## Computation outputs


Each function generates a set of output parameters. You can add these outputs to the autonarrative to customize what it displays. You can also add your own custom text. 

To locate the output parameters, open the **Computations** tab on the right, and locate the computation that you want to use. The names of the computations come from the name you provide when you create the insight. Choose the output parameter by clicking on it only once. If you click twice, you add the same output twice. Items displayed in **bold** can be used in the narrative. 

**Note**  
These are the same output parameters as the ones that are returned by the maximum computation.
+ `timeField` – From the **Time** field well.
  + `name` – The formatted display name of the field.
  + `timeGranularity` – The time field granularity (**DAY**, **YEAR**, and so on).
+ `metricField` – From the **Values** field well.
  + `name` – The formatted display name of the field.
  + `aggregationFunction` – The aggregation used for the metric (**SUM**, **AVG**, and so on).
+ `metricValue` – The value in the metric dimension.
  + `value` – The raw value.
  + `formattedValue` – The value formatted by the metric field.
  + `formattedAbsoluteValue` – The absolute value formatted by the metric field.
+ `timeValue` – The value in the datetime dimension.
  + `value` – The raw value.
  + `formattedValue` – The value formatted by the datetime field.

# Period over period computation


The period over period computation compares values from two different time periods. For example, you can create a computation to find out how much sales increased or decreased since the previous time period. 

To use this function, you need at least one dimension in the **Time** field well. 

## Parameters


*name*   
A unique descriptive name that you assign or change. A name is assigned if you don't create your own. You can edit this later.

*Date*   
The date dimension that you want to rank. 

*Value*   
The aggregated measure that the computation is based on. 

## Computation outputs


Each function generates a set of output parameters. You can add these outputs to the autonarrative to customize what it displays. You can also add your own custom text. 

To locate the output parameters, open the **Computations** tab on the right, and locate the computation that you want to use. The names of the computations come from the name you provide when you create the insight. Choose the output parameter by clicking on it only once. If you click twice, you add the same output twice. Items displayed in **bold** can be used in the narrative. 
+ `timeField` – From the **Time** field well.
  + `name` – The formatted display name of the field.
  + `timeGranularity` – The time field granularity (**DAY**, **YEAR**, and so on).
+ `metricField` – From the **Values** field well.
  + `name` – The formatted display name of the field.
  + `aggregationFunction` – The aggregation used for the metric (**SUM**, **AVG**, and so on).
+ `previousMetricValue` – The previous value in the metric dimension.
  + `value` – The raw value.
  + `formattedValue` – The value formatted by the metric field.
  + `formattedAbsoluteValue` – The absolute value formatted by the metric field.
+ `previousTimeValue` – The previous value in the datetime dimension.
  + `value` – The raw value.
  + `formattedValue` – The value formatted by the datetime field.
+ `currentMetricValue` – The current value in the metric dimension.
  + `value` – The raw value.
  + `formattedValue` – The value formatted by the metric field.
  + `formattedAbsoluteValue` – The absolute value formatted by the metric field.
+ `currentTimeValue` – The current value in the datetime dimension.
  + `value` – The raw value.
  + `formattedValue` – The value formatted by the datetime field.
+ `percentDifference` – The percent difference between the current and previous values of the metric field.
  + `value` – The raw value of the calculation of the percent difference.
  + `formattedValue` – The formatted value of the percent difference (for example, -42%).
  + `formattedAbsoluteValue` – The formatted absolute value of the percent difference (for example, 42%).
+ `absoluteDifference` – The absolute difference between the current and previous values of the metric field.
  + `value` – The raw value of the calculation of the absolute difference.
  + `formattedValue` – The absolute difference formatted by the settings in the metric field's format preferences.
  + `formattedAbsoluteValue` – The absolute value of the difference formatted by the metric field.

## Example


**To create a Period over period computation**

1. In the analysis that you want to change, choose **Add insight**.

1. For **Computation type**, choose **Period over period**, and then choose **Select**.

1. In the new insight that you created, add the time dimension and value dimension fields that you want to compare. In the screenshot below, `Order Date` and `Sales (Sum)` are added to the insight. With these two fields selected, Quick Sight shows the year to date sales of the latest month and the percentage difference compared with the previous month.  
![\[alt text not found\]](http://docs.aws.amazon.com/quick/latest/userguide/images/periodOverPeriod1.png)

1. (Optional) To further customize the insight, open the on-visual menu and choose **Customize narrative**. In the **Edit narative** window that appears, drag and drop the fields that you need from the **Computations** list, and then choose **Save**.

# Period to date computation


The period to date computation evaluates values for a specified period to date. For example, you can create a computation to find out how much you've earned in year-to-date sales. 

To use this function, you need at least one dimension in the **Time** field well. 

## Parameters


*name*   
A unique descriptive name that you assign or change. A name is assigned if you don't create your own. You can edit this later.

*Date*   
The date dimension that you want to rank. 

*Value*   
The aggregated measure that the computation is based on. 

*Time granularity*   
The date granularity that you want to use for the computation, for example year to date.

## Computation outputs


Each function generates a set of output parameters. You can add these outputs to the autonarrative to customize what it displays. You can also add your own custom text. 

To locate the output parameters, open the **Computations** tab on the right, and locate the computation that you want to use. The names of the computations come from the name you provide when you create the insight. Choose the output parameter by clicking on it only once. If you click twice, you add the same output twice. Items displayed in **bold** can be used in the narrative. 
+ `timeField` – From the **Time** field well. 
  + `name` – The formatted display name of the field.
  + `timeGranularity` – The time field granularity (**DAY**, **YEAR**, and so on).
+ `metricField` – From the **Values** field well. 
  + `name` – The formatted display name of the field.
  + `aggregationFunction` – The aggregation used for the metric (**SUM**, **AVG**, and so on).
+ `previousMetricValue` – The previous value in the metric dimension.
  + `value` – The raw value.
  + `formattedValue` – The value formatted by the metric field.
  + `formattedAbsoluteValue` – The absolute value formatted by the metric field.
+ `previousTimeValue` – The previous value in the datetime dimension.
  + `value` – The raw value.
  + `formattedValue` – The value formatted by the datetime field.
+ `currentMetricValue` – The current value in the metric dimension.
  + `value` – The raw value.
  + `formattedValue` – The value formatted by the metric field.
  + `formattedAbsoluteValue` – The absolute value formatted by the metric field.
+ `currentTimeValue` – The current value in the datetime dimension.
  + `value` – The raw value.
  + `formattedValue` – The value formatted by the datetime field.
+ `periodGranularity` – The period granularity for this computation (**MONTH**, **YEAR**, and so on).
+ `percentDifference` – The percent difference between the current and previous values of the metric field.
  + `value` – The raw value of the calculation of the percent difference.
  + `formattedValue` – The formatted value of the percent difference (for example, -42%).
  + `formattedAbsoluteValue` – The formatted absolute value of the percent difference (for example, 42%).
+ `absoluteDifference` – The absolute difference between the current and previous values of the metric field.
  + `value` – The raw value of the calculation of the absolute difference.
  + `formattedValue` – The absolute difference formatted by the settings in the metric field's format preferences.
  + `formattedAbsoluteValue` – The absolute value of the difference formatted by the metric field.

## Example


**To create a Period to date computation**

1. In the analysis that you want to change, choose **Add insight**.

1. For **Computation type**, choose **Period to date**, and then choose **Select**.

1. In the new insight that you created, add the time dimenstion and value dimension fields that you want to compare. In the screenshot below, `Order Date` and `Sales (Sum)` are added to the insight. With these two fields selected, Quick Sight shows the year to date sales of the latest month and the percentage difference compared with the previous month.  
![\[alt text not found\]](http://docs.aws.amazon.com/quick/latest/userguide/images/periodOverPeriod1.png)

1. (Optional) To further customize the insight, open the on-visual menu and choose **Customize narrative**. In the **Edit narative** window that appears, drag and drop the fields that you need from the **Computations** list, and then choose **Save**.

# Top movers computation


The top movers computation counts the requested number of categories by date that rank in the top of the autonarrative's dataset. For example, you can create a computation to find the top products by sales revenue for a time period.

To use this function, you need at least one dimension in the **Time** field well and at least one dimension in the **Categories** field well. 

## Parameters


*name*   
A unique descriptive name that you assign or change. A name is assigned if you don't create your own. You can edit this later.

*Category*   
The category dimension you want to rank. 

*Value*   
The aggregated measure that the computation is based on. 

*Number of results*   
The number of top ranking items you want to find.

## Computation outputs


Each function generates a set of output parameters. You can add these outputs to the autonarrative to customize what it displays. You can also add your own custom text. 

To locate the output parameters, open the **Computations** tab on the right, and locate the computation that you want to use. The names of the computations come from the name you provide when you create the insight. Choose the output parameter by clicking on it only once. If you click twice, you add the same output twice. Items displayed in **bold** can be used in the narrative. 

**Note**  
These are the same output parameters as the ones that are returned by the bottom movers computation.
+ `timeField` – From the **Time** field well.
  + `name` – The formatted display name of the field.
  + `timeGranularity` – The time field granularity (**DAY**, **YEAR**, and so on).
+ `categoryField` – From the **Categories** field well.
  + `name` – The formatted display name of the field.
+ `metricField` – From the **Values** field well.
  + `name` – The formatted display name of the field.
  + `aggregationFunction` – The aggregation used for the metric (**SUM**, **AVG**, and so on).
+ `startTimeValue` – The value in the date dimension.
  + `value` – The raw value.
  + `formattedValue` – The value formatted by the datetime field.
+ `endTimeValue` – The value in the date dimension.
  + `value` – The raw value.
  + `formattedValue` – The absolute value formatted by the datetime field.
+ `itemsCount` – The number of items included in this computation.
+ `items`: Top moving items.
  + `categoryField` – The category field.
    + `value` – The value (contents) of the category field.
    + `formattedValue` – The formatted value (contents) of the category field. If the field is null, this displays '`NULL`'. If the field is empty, it displays '`(empty)`'.
  + `currentMetricValue` – The current value for the metric field.
    + `value` – The raw value.
    + `formattedValue` – The value formatted by the metric field.
    + `formattedAbsoluteValue` – The absolute value formatted by the metric field.
  + `previousMetricValue` – The previous value for the metric field.
    + `value` – The raw value.
    + `formattedValue` – The value formatted by the metric field.
    + `formattedAbsoluteValue` – The absolute value formatted by the metric field.
  + `percentDifference` – The percent difference between the current and previous values of the metric field.
    + `value` – The raw value of the calculation of the percent difference.
    + `formattedValue` – The formatted value of the percent difference (for example, -42%).
    + `formattedAbsoluteValue` – The formatted absolute value of the percent difference (for example, 42%).
  + `absoluteDifference` – The absolute difference between the current and previous values of the metric field.
    + `value` – The raw value of the calculation of the absolute difference.
    + `formattedValue` – The absolute difference formatted by the settings in the metric field's format preferences.
    + `formattedAbsoluteValue` – The absolute value of the difference formatted by the metric field.

# Top ranked computation


The top ranked computation finds the top ranking dimensions by value. For example, you can create a computation to find the top three states by sales revenue. 

To use this function, you need at least one dimension in the **Categories** field well. 

## Parameters


*name*   
A unique descriptive name that you assign or change. A name is assigned if you don't create your own. You can edit this later.

*Category*   
The category dimension that you want to rank. 

*Value*   
The aggregated measure that the computation is based on. 

*Number of results*   
The number of top ranking items that you want to find.

## Computation outputs


Each function generates a set of output parameters. You can add these outputs to the autonarrative to customize what it displays. You can also add your own custom text. 

To locate the output parameters, open the **Computations** tab on the right, and locate the computation that you want to use. The names of the computations come from the name you provide when you create the insight. Choose the output parameter by clicking on it only once. If you click twice, you add the same output twice. Items displayed in **bold** can be used in the narrative. 

**Note**  
These are the same output parameters as the ones that are returned by the bottom ranked computation.
+ `categoryField` – From the **Categories** field well.
  + `name` – The formatted display name of the field.
+ `metricField` – From the **Values** field well.
  + `name` – The formatted display name of the field.
  + `aggregationFunction` – The aggregation used for the metric (**SUM**, **AVG**, and so on).
+ `itemsCount` – The number of items included in this computation.
+ `items`: Top ranked items.
  + `categoryField` – The category field.
    + `value` – The value (contents) of the category field.
    + `formattedValue` – The formatted value (contents) of the category field. If the field is null, this displays '`NULL`'. If the field is empty, it displays '`(empty)`'.
  + `metricValue` – The metric field.
    + `value` – The raw value.
    + `formattedValue` – The value formatted by the metric field.
    + `formattedAbsoluteValue` – The absolute value formatted by the metric field.

# Total aggregation computation


The total aggregation computation creates a grand total of the value. For example, you can create a computation to find the total revenue. 

To use this function, you need at least one dimension in the **Time** field well and at least one measure in the **Values** field well. 

## Parameters


*name*   
A unique descriptive name that you assign or change. A name is assigned if you don't create your own. You can edit this later.

*Value*   
The aggregated measure that the computation is based on. 

## Computation outputs


Each function generates a set of output parameters. You can add these outputs to the autonarrative to customize what it displays. You can also add your own custom text. 

To locate the output parameters, open the **Computations** tab on the right, and locate the computation that you want to use. The names of the computations come from the name you provide when you create the insight. Choose the output parameter by clicking on it only once. If you click twice, you add the same output twice. Items displayed in **bold** can be used in the narrative. 
+ `categoryField` – The category field. 
  + `name` – The display name of the category field.
+ `metricField` – From the **Values** field well. 
  + `name` – The formatted display name of the field.
  + `aggregationFunction` – The aggregation used for the metric (**SUM**, **AVG**, and so on).
+ `totalAggregate` – The total value of the metric aggregation. 
  + `value` – The raw value.
  + `formattedValue` – The value formatted by the metric field.
  + `formattedAbsoluteValue` – The absolute value formatted by the metric field.

# Unique values computation


The unique values computation counts the unique values in a category field. For example, you can create a computation to count the number of unique values in a dimension, such as how many customers you have

To use this function, you need at least one dimension in the **Categories** field well. 

## Parameters


*name*   
A unique descriptive name that you assign or change. A name is assigned if you don't create your own. You can edit this later.

*Category*   
The category dimension that you want to rank. 

## Computation outputs


Each function generates a set of output parameters. You can add these outputs to the autonarrative to customize what it displays. You can also add your own custom text. 

To locate the output parameters, open the **Computations** tab on the right, and locate the computation that you want to use. The names of the computations come from the name you provide when you create the insight. Choose the output parameter by clicking on it only once. If you click twice, you add the same output twice. Items displayed in **bold** can be used in the narrative. 
+ `categoryField` – The category field. 
  + `name` – The display name of the category field.
+ `uniqueGroupValuesCount` – The number of unique values included in this computation. 