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

# Atoti Tableau Adapter

The Atoti Tableau Adapter connects Tableau to an Atoti application so that cube data can be
visualized directly in Tableau.
The adapter is built on the [BI Adapter SQL endpoint](https://docs.activeviam.com/engine/java-sdk/6.2/user_guide/querying/front_ends/sql_endpoint.md), which lets a BI tool query an Atoti
cube using SQL.
It combines Tableau's visualization capabilities with Atoti's multidimensional data model.
There are some differences in the way that Tableau and Atoti behave.
The steps and details below indicate how to complete the set up and allow for accurate data
analysis.

> [!NOTE]
>
> This feature requires a license that enables the `bi-adapter` component.

## Prerequisites

* **Atoti application**: An active Atoti application with a cube available.
* **Atoti Tableau Adapter**:
  [Activated on the server](https://docs.activeviam.com/engine/java-sdk/6.2/user_guide/querying/front_ends/tableau/tableau_adapter_how_to.md#how-to-activate-the-atoti-tableau-adapter).
* **Tableau**: Tableau Desktop or Tableau Cloud access. Tableau Desktop is supported from version
  **2026.1** onwards. Tableau Cloud also requires Tableau Desktop, to publish the `.tds` file.
* **PostgreSQL JDBC driver**: Required for Tableau Desktop, including to publish to Tableau Cloud. The **42.7.7** version of the
  driver is the only one guaranteed to work with Atoti. This version may be upgraded in any bugfix
  release. However, if you have tested a more recent version and it does not work, please open a support ticket.

## How is an Atoti cube represented in Tableau?

Once connected through the Tableau Adapter, the cube appears on Tableau's data source page.

When Atoti exposes a cube to BI tools, it builds a flat table whose columns
are the cube's levels and measures. Not every element of the cube is exposed: the sections below
describe which ones are included and which are excluded.

### Levels and measures exposed by Atoti

The visibility of a level or a measure in an Atoti cube is respected.
For levels, this means the level's hierarchy is marked as visible; for measures, the measure itself
has a visible flag. Elements marked as hidden in the cube configuration are excluded.

There are special cases:

* The `AllMember` level is never included.
* The measure hierarchy itself is never included.

### Analysis hierarchies

Analysis hierarchies whose members are **user-defined** (i.e., hardcoded within the project rather
than derived from data in a store) are exposed to BI tools as strings.

Analysis hierarchies whose members are derived from a store field are exposed normally. To link
an analysis hierarchy to one or more store fields, its description must be customized, as in the
example below:

```java theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
final IActivePivotInstanceDescription cubeDescription =
    StartBuilding.cube("cube")
        .withDimension("dimension")
        .withAnalysisHierarchy("analysisHierarchy", "pluginKey")
        .withCustomizations(
            desc ->
                desc.setLevels(List.of(new AxisLevelDescription("levelName", "storeField"))))
        .build();
return cubeDescription;
```

### Fields classification by Tableau

*Field* is the term used by Tableau to designate a column in a discovered SQL table.
In this case, this refers to both exposed cube levels and measures.

Internally, Tableau automatically identifies each field as a *dimension* or *measure*.
This classification is made depending on the type of data the field contains.
A field is also classified as *discrete* or *continuous* based on Tableau's standard logic.
More information can be found in [the official documentation](https://help.tableau.com/current/pro/desktop/en-us/datafields_typesandroles.htm).

The image below illustrates how Atoti exposed levels and measures are represented in the *Data* pane.

![Tableau measures and levels](https://mintcdn.com/activeviam/A7IXC6LWL2iNLCTE/engine/java-sdk/6.2/assets/user_guide/tableau_bi_adapter/tableau_measures_levels.png?fit=max\&auto=format\&n=A7IXC6LWL2iNLCTE\&q=85\&s=1d56dcaa24bc11b44537b8e8ce3912fd)

### How to reproduce the cube's structure

Tableau is unaware of the cube's structure behind the SQL table.
The `.tds` file [generated by Atoti](https://docs.activeviam.com/engine/java-sdk/6.2/user_guide/querying/front_ends/tableau/tableau_adapter_how_to.md#connect-using-a-tableau-data-source-file)
declares Tableau hierarchies that mirror the cube's multilevel hierarchies.
The following steps adjust that structure in Tableau.

#### Create a hierarchy

1. Right-click the dimension (Atoti level) in the Data pane.
2. Select `Hierarchy` and `Create Hierarchy`.

![Create a hierarchy in Tableau](https://mintcdn.com/activeviam/A7IXC6LWL2iNLCTE/engine/java-sdk/6.2/assets/user_guide/tableau_bi_adapter/tableau_hierarchy1.png?fit=max\&auto=format\&n=A7IXC6LWL2iNLCTE\&q=85\&s=7a2c46a32e2b02df1e2a04e55e841093)

#### Add a level to an existing hierarchy

1. Right-click the dimension (Atoti level) in the Data pane.
2. Select `Hierarchy` and `Add to Hierarchy`.

![Add a level to an existing hierarchy in Tableau](https://mintcdn.com/activeviam/A7IXC6LWL2iNLCTE/engine/java-sdk/6.2/assets/user_guide/tableau_bi_adapter/tableau_hierarchy2.png?fit=max\&auto=format\&n=A7IXC6LWL2iNLCTE\&q=85\&s=8ba75c37f3afab804a80df04b167a133)

#### Adjust the granularity of the dashboard

Once a hierarchy has been created and populated, it can be used to drill down or up.
This can be done by clicking on the `+` or `-` icon next to the hierarchy level:

![Lowest granularity level](https://mintcdn.com/activeviam/A7IXC6LWL2iNLCTE/engine/java-sdk/6.2/assets/user_guide/tableau_bi_adapter/tableau_drilldown1.png?fit=max\&auto=format\&n=A7IXC6LWL2iNLCTE\&q=85\&s=6f43bfb072ed74651663d1d071177519)

![Higher granularity level](https://mintcdn.com/activeviam/A7IXC6LWL2iNLCTE/engine/java-sdk/6.2/assets/user_guide/tableau_bi_adapter/tableau_drilldown2.png?fit=max\&auto=format\&n=A7IXC6LWL2iNLCTE\&q=85\&s=0b9b6fe62e4acd800af83b76d95315d1)

#### Save the structure

Once the cube's structure has been reproduced, it is possible to save it for later Tableau sessions
using the Tableau-specific `.tds` file format.

1. Right-click on the cube's name in the Data pane
2. Select `Add to Saved Data Sources`
3. Save the file using the `.tds` format

![Save TDS](https://mintcdn.com/activeviam/A7IXC6LWL2iNLCTE/engine/java-sdk/6.2/assets/user_guide/tableau_bi_adapter/tableau_saveTds.png?fit=max\&auto=format\&n=A7IXC6LWL2iNLCTE\&q=85\&s=17b0ec1d4be0aea09dc49de4fc40132a)

## How live mode works

In live mode, Tableau sends a SQL query to the cube each time a visualization is displayed.

### Use of measures

When a measure is placed in the view, Tableau adds an aggregation operator (for example,
`SUM(Mtm.SUM)`).
Atoti ignores this operator because the measure is already aggregated in the cube.
Changing the aggregation function in Tableau does not affect the cube result.

Changing a measure to a dimension or an attribute does not change the result either.
Tableau still displays a single value per member.
This value corresponds to the aggregated value computed by Atoti from multiple underlying facts.

> In extract mode or when joining with other tables, Tableau may apply aggregation on its side.

## How extract mode works

Extract mode retrieves data from the cube and stores it locally in Tableau.
No live queries are sent after extraction, so data can be queried even if the cube is offline.

### Considerations

* Apply filters to limit the extraction scope.
* Hide unnecessary fields to reduce data volume.
* Aggregation operators are applied by Tableau in this mode.
* Be cautious with reaggregation:
  * `Mtm.SUM` can be reaggregated with `SUM` or `AVG`.
  * Non-linear measures cannot be reaggregated.

## What are the supported data types?

The following types are supported without any required action:

* `String`
* `Double`
* `Boolean`
* `Long`
* `Int`
* `Float`
* `Array`

Non-standard data types are currently not supported.

### Date and time support

Tableau's default behavior with date and time fields is to extract the different parts of those fields to allow drilldown.
For example, the year of a date field is extracted first, and the user can then drill down to the month and the day.
This behavior may lead to incorrect results, due to a semantic gap between SQL and the Atoti OLAP Cube.
Tableau extracts the date component using SQL functions (`EXTRACT`, `CAST`, `TRUNC`), and may reaggregate the values, leading to incorrect results.

The following error message is displayed when it occurs: `Atoti does not support Tableau's default behavior with date fields`

> More generally, calculated fields are not supported by the Atoti Tableau Adapter.
> Only the plain detected Atoti fields can be queried.

There are three ways to work around this limitation:

#### Option 1: Modify the date's format after it has been dropped as a column or row

Once the error message has been thrown and closed, it is possible to change the date's format:

1. Right-click the date field
2. Select `Exact Date`

![Change the date's format to exact date](https://mintcdn.com/activeviam/A7IXC6LWL2iNLCTE/engine/java-sdk/6.2/assets/user_guide/tableau_bi_adapter/tableauExactDate.png?fit=max\&auto=format\&n=A7IXC6LWL2iNLCTE\&q=85\&s=109105247bae2a18936046c6a50ee1db)

#### Option 2: Modify the field's data type

Use a right-click drag instead of a left-click drag
for date and time fields:

1. Right-click the date or time field in the Data pane (do not left-click).
2. Drag and drop it into the desired location (for example, Columns or Rows).
3. From the context menu, select the `(Discrete)` option for the field.

This displays the exact date values without any extraction.

The following screenshots illustrate each step of the workaround.

![Right-clicking on a date field in the Data pane](https://mintcdn.com/activeviam/A7IXC6LWL2iNLCTE/engine/java-sdk/6.2/assets/user_guide/tableau_bi_adapter/tableau_date_right_click.png?fit=max\&auto=format\&n=A7IXC6LWL2iNLCTE\&q=85\&s=23348b591c4d9555139193e96d9b987b)

![Dropping the date field into the view](https://mintcdn.com/activeviam/A7IXC6LWL2iNLCTE/engine/java-sdk/6.2/assets/user_guide/tableau_bi_adapter/tableau_date_drop_field.png?fit=max\&auto=format\&n=A7IXC6LWL2iNLCTE\&q=85\&s=51939abfeab13d47c02828b7bbe71562)

![Selecting the discrete date option from the context menu](https://mintcdn.com/activeviam/A7IXC6LWL2iNLCTE/engine/java-sdk/6.2/assets/user_guide/tableau_bi_adapter/tableau_discrete_date.png?fit=max\&auto=format\&n=A7IXC6LWL2iNLCTE\&q=85\&s=515e6760b8b697229a93c49d751205b2)

#### Option 3: Configure a multi-level date hierarchy in Atoti Server

Instead of exposing a flat, single-level date hierarchy with members like `2024-11-21`,
configure the cube with a multi-level date hierarchy that has separate levels for each date part, for example Year > Month > Day.

With this setup, Tableau can query each date part (year, month, day) directly as a separate level, without needing to extract it client-side.
This also enables proper drilldown behavior in Tableau.

## Data preview

Some Tableau screens allow a preview of a cube's content.

Atoti serves any query with a `LIMIT` clause and no `GROUP BY` clause, such as a data preview,
as a drillthrough, whatever columns it selects.
A drillthrough retrieves the stored records instead of aggregating them, so not all values are
retrieved:

* A level column has a value only if a store field has exactly the name of the level.
  Otherwise, its value is `null`.
* Every measure column is `null`, except `contributors.COUNT`, which is `1` for each row.
  Atoti cannot reliably map a measure back to its store field: for instance, a vector store field
  and a measure can share a name but hold different value types, such as the sum of the vector's
  coordinates.
