---
title: "POST /#X-Amz-Target=AmazonForecast.CreateWhatIfAnalysis"
method: POST
path: "/#X-Amz-Target=AmazonForecast.CreateWhatIfAnalysis"
---

# POST /#X-Amz-Target=AmazonForecast.CreateWhatIfAnalysis

`POST /#X-Amz-Target=AmazonForecast.CreateWhatIfAnalysis`

What-if analysis is a scenario modeling technique where you make a hypothetical change to a time series and compare the forecasts generated by these changes against the baseline, unchanged time series. It is important to remember that the purpose of a what-if analysis is to understand how a forecast can change given different modifications to the baseline time series.

For example, imagine you are a clothing retailer who is considering an end of season sale to clear space for new styles. After creating a baseline forecast, you can use a what-if analysis to investigate how different sales tactics might affect your goals.

You could create a scenario where everything is given a 25% markdown, and another where everything is given a fixed dollar markdown. You could create a scenario where the sale lasts for one week and another where the sale lasts for one month. With a what-if analysis, you can compare many different scenarios against each other.

Note that a what-if analysis is meant to display what the forecasting model has learned and how it will behave in the scenarios that you are evaluating. Do not blindly use the results of the what-if analysis to make business decisions. For instance, forecasts might not be accurate for novel scenarios where there is no reference available to determine whether a forecast is good.

The TimeSeriesSelector object defines the items that you want in the what-if analysis.

## Headers

- `X-Amz-Target` 'AmazonForecast.CreateWhatIfAnalysis', required

## Request body

- CreateWhatIfAnalysisRequest
  - `WhatIfAnalysisName` string, required — The name of the what-if analysis. Each name must be unique.
  - `ForecastArn` string, required — The Amazon Resource Name (ARN) of the baseline forecast.
  - `TimeSeriesSelector` object — <p>Defines the set of time series that are used in the what-if analysis with a <code>TimeSeriesIdentifiers</code> object. What-if analyses are performed only for the time series in this object.</p> <p>The <code>TimeSeriesIdentifiers</code> object needs the following information:</p> <ul> <li> <p> <code>DataSource</code> </p> </li> <li> <p> <code>Format</code> </p> </li> <li> <p> <code>Schema</code> </p> </li> </ul>
    - `TimeSeriesIdentifiers` object — Details about the import file that contains the time series for which you want to create forecasts.
      - `DataSource` DataSource — The source of your data, an Identity and Access Management (IAM) role that allows Amazon Forecast to access the data and, optionally, an Key Management Service (KMS) key.
        - `S3Config` object, required — The path to the data stored in an Amazon Simple Storage Service (Amazon S3) bucket along with the credentials to access the data.
          - `Path` string, required — The path to an Amazon Simple Storage Service (Amazon S3) bucket or file(s) in an Amazon S3 bucket.
          - `RoleArn` string, required — <p>The ARN of the Identity and Access Management (IAM) role that Amazon Forecast can assume to access the Amazon S3 bucket or files. If you provide a value for the <code>KMSKeyArn</code> key, the role must allow access to the key.</p> <p>Passing a role across Amazon Web Services accounts is not allowed. If you pass a role that isn't in your account, you get an <code>InvalidInputException</code> error.</p>
          - `KMSKeyArn` string — The Amazon Resource Name (ARN) of an Key Management Service (KMS) key.
      - `Schema` Schema — Defines the fields of a dataset.
        - `Attributes` SchemaAttribute[] — An array of attributes specifying the name and type of each field in a dataset.
          - `AttributeName` string — The name of the dataset field.
          - `AttributeType` 'string' | 'integer' | 'float' | 'timestamp' | 'geolocation' — <p>The data type of the field.</p> <p>For a related time series dataset, other than date, item_id, and forecast dimensions attributes, all attributes should be of numerical type (integer/float).</p>
      - `Format` string — The format of the data, either CSV or PARQUET.
  - `Tags` Tag[] — A list of <a href="https://docs.aws.amazon.com/forecast/latest/dg/tagging-forecast-resources.html">tags</a> to apply to the what if forecast.
    - `Key` string, password, required — One part of a key-value pair that makes up a tag. A <code>key</code> is a general label that acts like a category for more specific tag values.
    - `Value` string, password, required — The optional part of a key-value pair that makes up a tag. A <code>value</code> acts as a descriptor within a tag category (key).

## Response `200`

Success

- CreateWhatIfAnalysisResponse
  - `WhatIfAnalysisArn` string — The Amazon Resource Name (ARN) of the what-if analysis.

## Other responses

- `480` — InvalidInputException
- `481` — ResourceAlreadyExistsException
- `482` — ResourceNotFoundException
- `483` — ResourceInUseException
- `484` — LimitExceededException

---

[API](https://skmtc.net/aws/apis/forecast.md) · [All operations](https://skmtc.net/aws/apis/forecast/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/aws/forecast/versions/3d1c872d2ac9/schema)
