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

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

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

A what-if forecast is a forecast that is created from a modified version of the baseline forecast. Each what-if forecast incorporates either a replacement dataset or a set of transformations to the original dataset.

## Headers

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

## Request body

- CreateWhatIfForecastRequest
  - `WhatIfForecastName` string, required — The name of the what-if forecast. Names must be unique within each what-if analysis.
  - `WhatIfAnalysisArn` string, required — The Amazon Resource Name (ARN) of the what-if analysis.
  - `TimeSeriesTransformations` TimeSeriesTransformation[] — The transformations that are applied to the baseline time series. Each transformation contains an action and a set of conditions. An action is applied only when all conditions are met. If no conditions are provided, the action is applied to all items.
    - `Action` object — An array of actions that define a time series and how it is transformed. These transformations create a new time series that is used for the what-if analysis.
      - `AttributeName` string, required — The related time series that you are modifying. This value is case insensitive.
      - `Operation` 'ADD' | 'SUBTRACT' | 'MULTIPLY' | 'DIVIDE', required — <p>The operation that is applied to the provided attribute. Operations include:</p> <ul> <li> <p> <code>ADD</code> - adds <code>Value</code> to all rows of <code>AttributeName</code>.</p> </li> <li> <p> <code>SUBTRACT</code> - subtracts <code>Value</code> from all rows of <code>AttributeName</code>.</p> </li> <li> <p> <code>MULTIPLY</code> - multiplies all rows of <code>AttributeName</code> by <code>Value</code>.</p> </li> <li> <p> <code>DIVIDE</code> - divides all rows of <code>AttributeName</code> by <code>Value</code>.</p> </li> </ul>
      - `Value` number, double, required — The value that is applied for the chosen <code>Operation</code>.
    - `TimeSeriesConditions` TimeSeriesCondition[] — An array of conditions that define which members of the related time series are transformed.
      - `AttributeName` string, required — The item_id, dimension name, IM name, or timestamp that you are modifying.
      - `AttributeValue` string, required — The value that is applied for the chosen <code>Condition</code>.
      - `Condition` 'EQUALS' | 'NOT_EQUALS' | 'LESS_THAN' | 'GREATER_THAN', required — The condition to apply. Valid values are <code>EQUALS</code>, <code>NOT_EQUALS</code>, <code>LESS_THAN</code> and <code>GREATER_THAN</code>.
  - `TimeSeriesReplacementsDataSource` object — <p>The replacement time series dataset, which contains the rows that you want to change in the related time series dataset. A replacement time series does not need to contain all rows that are in the baseline related time series. Include only the rows (measure-dimension combinations) that you want to include in the what-if forecast.</p> <p>This dataset is merged with the original time series to create a transformed dataset that is used for the what-if analysis.</p> <p>This dataset should contain the items to modify (such as item_id or workforce_type), any relevant dimensions, the timestamp column, and at least one of the related time series columns. This file should not contain duplicate timestamps for the same time series.</p> <p>Timestamps and item_ids not included in this dataset are not included in the what-if analysis. </p>
    - `S3Config` S3Config, required — The path to the file(s) in an Amazon Simple Storage Service (Amazon S3) bucket, and an Identity and Access Management (IAM) role that Amazon Forecast can assume to access the file(s). Optionally, includes an Key Management Service (KMS) key. This object is part of the <a>DataSource</a> object that is submitted in the <a>CreateDatasetImportJob</a> request, and part of the <a>DataDestination</a> object.
      - `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, required — 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 replacement data, CSV or PARQUET.
    - `TimestampFormat` string — The timestamp format of the replacement data.
  - `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

- CreateWhatIfForecastResponse
  - `WhatIfForecastArn` string — The Amazon Resource Name (ARN) of the what-if forecast.

## 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)
