> ## Documentation Index
> Fetch the complete documentation index at: https://alphacastio.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Append Dataset

> Stack datasets with the same structure on top of each other, with control over duplicate handling.

The **Append Dataset** step combines datasets with the same structure one on top of the other. Use it when the same data lives in separate datasets — different months or years, for example — and you need it as one series.

Select the datasets to append and the variables to include, then choose how duplicates should be handled.

<Frame>
  <img src="https://mintcdn.com/alphacastio/ttF_U-V9HDrmrPbo/images/steps/append-dataset-1.jpg?fit=max&auto=format&n=ttF_U-V9HDrmrPbo&q=85&s=06833456d74c91a12752acd0260cab43" alt="Selecting datasets and variables to append" width="1173" height="494" data-path="images/steps/append-dataset-1.jpg" />
</Frame>

<Warning>
  Check that the datasets really do share the same structure before appending. Mismatched column names produce sparse columns rather than an error.
</Warning>

## Fetching and modifying before appending

You can also transform data before it is appended:

<Steps>
  <Step title="Fetch the source">
    In the **Fetch** step, select the dataset you want to take data from, and apply any steps you need.
  </Step>

  <Step title="Configure duplicate handling">
    In the **Append Dataset** step, choose how duplicate records are dropped: keep the first occurrence, keep the last occurrence, or drop all duplicates.

    <Frame>
      <img src="https://mintcdn.com/alphacastio/ttF_U-V9HDrmrPbo/images/steps/append-dataset-2.jpg?fit=max&auto=format&n=ttF_U-V9HDrmrPbo&q=85&s=5fb7560b464ddf6ca88fb1d4f02ebbf7" alt="Duplicate handling options in the Append Dataset step" width="987" height="443" data-path="images/steps/append-dataset-2.jpg" />
    </Frame>
  </Step>
</Steps>

<Note>
  Appending stacks rows vertically. To join datasets side by side on shared entities, use [Merge branches](/steps/merge).
</Note>

## Next steps

<CardGroup cols={2}>
  <Card title="Merge branches" icon="code-merge" href="/steps/merge">
    Join datasets on common entities instead.
  </Card>

  <Card title="Sort values" icon="arrow-down-short-wide" href="/steps/sort-rows">
    Restore chronological order after appending.
  </Card>
</CardGroup>
