# Retain report data with Writeback

## Retain report data with Writeback

Write back tabular reports to a data platform of choice, including file destinations, data warehouses, and data lake storage. For example, your actuals reporting may be tied to SQL Server, but you can use Writeback to export your plans and forecasts to data platforms like SnowFlake, Fabric, or Databricks.

Once the report data is written back, it can be queried and joined with other enterprise data. With writeback, static reports can be transformed into analytical data.

#### Create and manage writeback destinations

Configure the database and table where the report data will be saved during writeback.

1. Click **Writeback** > **Add Destination**.
2. Select an existing connection or create a new connection to the database. For more information, see [Create a database connection](https://inforiver.gitbook.io/fabric-plan-mslearn/planning-sheets/how-tos/get-started-with-planning-sheets#create-a-database-connection).
3. Select the database where the writeback destination table will be created.
4. Select the schema and table name. The table will be created during the first writeback instance.
5. Specify the decimal precision for numeric data. All numeric values, including percentages, will be rounded off to the specified number of decimal points.
6. Specify the text length - you can restrict text fields to 512 characters or allow writeback up to the maximum limit supported by the backend.

<figure><img src="https://2715773316-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXaNsuBB3HcAa0WUQhDTv%2Fuploads%2FgKUCbDvB8Zth7IkafHAW%2Fimage.png?alt=media&#x26;token=328b76c1-de5c-4ef7-b252-6a00d50f79e0" alt=""><figcaption></figcaption></figure>

7. After the destination is created, click the information icon in **Writeback Settings > Destinations**. to view the connection details, schema, and table name. You can also edit or delete a destination.

<figure><img src="https://2715773316-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXaNsuBB3HcAa0WUQhDTv%2Fuploads%2Fever4iytBSKvChPzz0pW%2Fimage.png?alt=media&#x26;token=6b342adb-c397-4749-b406-76534f867443" alt=""><figcaption></figcaption></figure>

8. Review the decimal precision and maximum text length configurations in **Writeback Settings > General.**

<figure><img src="https://2715773316-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXaNsuBB3HcAa0WUQhDTv%2Fuploads%2FWD1XuMoeCpcvpWXIebZt%2Fimage.png?alt=media&#x26;token=fcd0fc1f-8238-4b76-be5a-3fdb5c83e976" alt=""><figcaption></figcaption></figure>

#### Set the writeback type

Choose the writeback table structure. Click on the information icon to see a preview of how the data in your report will be written back.

<figure><img src="https://2715773316-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXaNsuBB3HcAa0WUQhDTv%2Fuploads%2Fz2pbMIyhBDUh2d3D3n0v%2Fimage.png?alt=media&#x26;token=87fb1d17-4358-469f-ad36-07c4b8ca7bcd" alt=""><figcaption></figcaption></figure>

* **Long:** The measures and associated values are stored as key-vaue pairs in the destination. The ValueColumn field contains the measure name and the Value field contains the associated value.

<figure><img src="https://2715773316-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXaNsuBB3HcAa0WUQhDTv%2Fuploads%2FMpPlvdlvBd9Lto1bbu60%2Fimage.png?alt=media&#x26;token=76846405-8be2-4ee3-aab6-5f8be5f9b0d9" alt=""><figcaption></figcaption></figure>

* **Wide:** Measure sare stored as columns. As more measures are added, a proportional number of columns will be added to the writeback table.

<figure><img src="https://2715773316-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXaNsuBB3HcAa0WUQhDTv%2Fuploads%2F8uJNCoTcmPVxp7o8deNM%2Fimage.png?alt=media&#x26;token=e3603803-157e-4cdd-8bdc-78d474539e31" alt=""><figcaption></figcaption></figure>

* **Long with changes**: Only the changed records are written back. When new data comes into the database, the old data is moved to a *PreviousValue* column, and the new data takes its place under the *Value* column. The IsLatest column is set to 1 to indicate the latest row.

The highlighted rows show how changed data is saved to the destination table.

<figure><img src="https://2715773316-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXaNsuBB3HcAa0WUQhDTv%2Fuploads%2FbJBDexHpprZChZsgm0dz%2Fimage.png?alt=media&#x26;token=3b264ddf-472b-4aa5-9513-5fb936f128da" alt=""><figcaption></figcaption></figure>

* **Wide with changes:** This writeback type also performs a delta writeback - only changed records are written back. In this format, each measure is stored as a separate column in the database. Change history is maintained, and the active record can be identified using the IsLatest column.

<figure><img src="https://2715773316-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXaNsuBB3HcAa0WUQhDTv%2Fuploads%2FlgdQEQmtUouopiISPb1C%2Fimage.png?alt=media&#x26;token=4245bcf3-769a-4268-a91b-64867dfc5b65" alt=""><figcaption></figcaption></figure>

#### Monitor writeback history and logs

1. Click **View Logs** to view details such as writeback status, duration, type, and initiator.

<figure><img src="https://2715773316-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXaNsuBB3HcAa0WUQhDTv%2Fuploads%2FLCbW4M7E8NAMcASoVT4D%2Fimage.png?alt=media&#x26;token=a69b87e6-3ede-4569-a828-1332cd75fee6" alt=""><figcaption></figcaption></figure>

2\. Click **Status** to filter writeback logs based on the run status.

<figure><img src="https://2715773316-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXaNsuBB3HcAa0WUQhDTv%2Fuploads%2FBevH2xD6oclsdEFMocR5%2Fimage.png?alt=media&#x26;token=cca3f92e-a697-41c7-91d6-1cbfca0b17e9" alt=""><figcaption></figcaption></figure>

3. Select **Created at** to filter writeback logs based on when they were triggered.

<figure><img src="https://2715773316-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXaNsuBB3HcAa0WUQhDTv%2Fuploads%2F3lSx4fUZjUmYpgWgGnYZ%2Fimage.png?alt=media&#x26;token=b84bae2d-aa54-41c0-bb62-afb36ccd7be0" alt=""><figcaption></figcaption></figure>

4. Click the writeback ID to view details about a specific run instance.

<figure><img src="https://2715773316-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXaNsuBB3HcAa0WUQhDTv%2Fuploads%2FZNJgFCCvWilWK3fugckm%2Fimage.png?alt=media&#x26;token=53a9f9f4-4aae-4be6-995d-3cb837c0fdfc" alt=""><figcaption></figcaption></figure>

#### Create a date key field in the destination table

Reports are often used for high-level aggregations, such as revenue by year-month or quarter. In these cases, the **Add date key** feature adds a Date Key column to the destination table. Date values are populated by appending the first day of the corresponding period to the aggregated date.

For example, if the report is at the year–month level, the product writes **01-01-2023** for Jan 2023 or if the report is at quarter level, the date key field will contain the first date of each quarter.

1. Navigate to **Writeback Settings** > **General** tab > **Date Key Configuration** and click **Add Date Key.**
2. Select **Current year** or enter the year to be used in the date key.
3. Enter the column name for the date key field that will be added to the destination table.

<figure><img src="https://2715773316-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXaNsuBB3HcAa0WUQhDTv%2Fuploads%2F6rdWa5Xelzhq3UUf2uMK%2Fimage.png?alt=media&#x26;token=8b7c6124-5eb0-4987-822a-9de38c455f81" alt=""><figcaption></figcaption></figure>

4. As the report is at quarter level, the date key is added for each quarter.

<figure><img src="https://2715773316-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXaNsuBB3HcAa0WUQhDTv%2Fuploads%2FliWcxdfViCInUMB8RbrH%2Fimage.png?alt=media&#x26;token=e3fa7821-8f99-46b9-a2c8-24915b09118e" alt=""><figcaption></figcaption></figure>

#### Configure columns in the destination

The column names in the writeback table can be different from the measure or dimension name in the data source. To rename a field:

1. Click **Column Rename.**
2. Click the edit icon and enter the new name.
3. Click the green tick symbol to apply the change.

{% hint style="info" %}
You can also change column names from **Writeback Settings** > **Advanced** > **Writeback column rename**.
{% endhint %}

<figure><img src="https://2715773316-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXaNsuBB3HcAa0WUQhDTv%2Fuploads%2FjAbiyRQGwXxNSIyoAPey%2Fimage.png?alt=media&#x26;token=81b3dab0-e94c-49ff-a4ec-df3a5a0ddb0c" alt=""><figcaption></figcaption></figure>

You can select the measures in your report that should be saved to the writeback table.

1. Open **Writeback Settings** > **Data** tab.
2. Select the measures to writeback.

<figure><img src="https://2715773316-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXaNsuBB3HcAa0WUQhDTv%2Fuploads%2FKyMwLiErAJjzOX7o5Yk8%2Fimage.png?alt=media&#x26;token=42160630-adb6-4af7-b8ff-7418f5f13044" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fabricplan.com/intelligence-sheets/how-tos/retain-report-data-with-writeback.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
