> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-detect-table-modification.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Microsoft Power BI is an interactive data visualization software product developed by Microsoft with a primary focus on business intelligence.

# Power BI

export const ClickHouseSupportedBadge = () => {
  return <div className="ClickHouseSupportedBadge">
            <div className="ClickHouseSupportedIcon">
                <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
                    <path d="M1.30762 1.39073C1.30762 1.3103 1.37465 1.22986 1.46849 1.22986H2.64824C2.72868 1.22986 2.80912 1.29689 2.80912 1.39073V14.4886C2.80912 14.5691 2.74209 14.6495 2.64824 14.6495H1.46849C1.38805 14.6495 1.30762 14.5825 1.30762 14.4886V1.39073Z" fill="currentColor" />
                    <path d="M4.2832 1.39073C4.2832 1.3103 4.35023 1.22986 4.44408 1.22986H5.62383C5.70427 1.22986 5.7847 1.29689 5.7847 1.39073V14.4886C5.7847 14.5691 5.71767 14.6495 5.62383 14.6495H4.44408C4.36364 14.6495 4.2832 14.5825 4.2832 14.4886V1.39073Z" fill="currentColor" />
                    <path d="M7.25977 1.39073C7.25977 1.3103 7.3268 1.22986 7.42064 1.22986H8.60039C8.68083 1.22986 8.76127 1.29689 8.76127 1.39073V14.4886C8.76127 14.5691 8.69423 14.6495 8.60039 14.6495H7.42064C7.3402 14.6495 7.25977 14.5825 7.25977 14.4886V1.39073Z" fill="currentColor" />
                    <path d="M10.2354 1.39073C10.2354 1.3103 10.3024 1.22986 10.3962 1.22986H11.576C11.6564 1.22986 11.7369 1.29689 11.7369 1.39073V14.4886C11.7369 14.5691 11.6698 14.6495 11.576 14.6495H10.3962C10.3158 14.6495 10.2354 14.5825 10.2354 14.4886V1.39073Z" fill="currentColor" />
                    <path d="M13.2256 6.6057C13.2256 6.52526 13.2926 6.44482 13.3865 6.44482H14.5662C14.6466 6.44482 14.7271 6.51186 14.7271 6.6057V9.27354C14.7271 9.35398 14.6601 9.43442 14.5662 9.43442H13.3865C13.306 9.43442 13.2256 9.36739 13.2256 9.27354V6.6057Z" fill="currentColor" />
                </svg>
            </div>
            ClickHouse Supported
        </div>;
};

export const Image = ({img, alt, size = "lg"}) => {
  const normalizedSize = ["sm", "md", "lg"].includes(size) ? size : "lg";
  return <div className={`ch-image-${normalizedSize}`}>
      <Frame>
        <img src={img} alt={alt} />
      </Frame>
    </div>;
};

Microsoft Power BI can query or load into memory data from [ClickHouse Cloud](https://clickhouse.com/cloud) or a self-managed deployment.

There are several flavours of Power BI that you can use to visualise your data:

* Power BI Desktop: A Windows desktop application for creating Dashboards and Visualisations
* Power BI Service: Available within Azure as a SaaS to host the Dashboards created on Power BI Desktop

Power BI requires you to create your dashboards within the Desktop version and publish them to Power BI Service.

This tutorial will guide you through the process of:

* [Installing the ClickHouse ODBC Driver](#install-the-odbc-driver)
* [Installing the ClickHouse Power BI Connector into Power BI Desktop](#power-bi-installation)
* [Querying data from ClickHouse for visualization in Power BI Desktop](#query-and-visualise-data)
* [Setting up an on-premise data gateway for Power BI Service](#power-bi-service)

<h2 id="prerequisites">
  Prerequisites
</h2>

<h3 id="power-bi-installation">
  Power BI Installation
</h3>

This tutorial assumes you have Microsoft Power BI Desktop installed on your Windows machine. You can download and install Power BI Desktop [here](https://www.microsoft.com/en-us/download/details.aspx?id=58494)

We recommend updating to the latest version of Power BI. The ClickHouse Connector is available by default from version `2.137.751.0`.

<h3 id="gather-your-clickhouse-connection-details">
  Gather your ClickHouse connection details
</h3>

You'll need the following details for connecting to your ClickHouse instance:

* Hostname - ClickHouse
* Username - User credentials
* Password - Password of the user
* Database - Name of the database on the instance you want to connect to

<h2 id="power-bi-desktop">
  Power BI desktop
</h2>

To get started with querying data in Power BI Desktop, you'll need to complete the following steps:

1. Install the ClickHouse ODBC Driver
2. Find the ClickHouse Connector
3. Connect to ClickHouse
4. Query and Visualize you data

<h3 id="install-the-odbc-driver">
  Install the ODBC Driver
</h3>

Download the most recent [ClickHouse ODBC release](https://github.com/ClickHouse/clickhouse-odbc/releases).

Execute the supplied `.msi` installer and follow the wizard.

<Image size="md" img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/svLCKm9RWi4jibqG/images/integrations/data-visualization/powerbi_odbc_install.webp?fit=max&auto=format&n=svLCKm9RWi4jibqG&q=85&s=bb5b217cc0f72cfb3efa0ab67bc091f9" alt="ClickHouse ODBC driver installation wizard showing installation options" border width="676" height="514" data-path="images/integrations/data-visualization/powerbi_odbc_install.webp" />

<br />

<Note>
  `Debug symbols` are optional and not required
</Note>

<h4 id="verify-odbc-driver">
  Verify ODBC driver
</h4>

When the driver installation is completed, you can verify the installation was successful by:

Searching for ODBC in the Start menu and select "ODBC Data Sources **(64-bit)**".

<Image size="md" img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/svLCKm9RWi4jibqG/images/integrations/data-visualization/powerbi_odbc_search.webp?fit=max&auto=format&n=svLCKm9RWi4jibqG&q=85&s=f60cfc405ca82d22b0e4e72365d3f686" alt="Windows search showing ODBC Data Sources (64-bit) option" border width="826" height="676" data-path="images/integrations/data-visualization/powerbi_odbc_search.webp" />

<br />

Verify the ClickHouse Driver is listed.

<Image size="md" img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/svLCKm9RWi4jibqG/images/integrations/data-visualization/powerbi_odbc_verify.webp?fit=max&auto=format&n=svLCKm9RWi4jibqG&q=85&s=667bdce7ea7d674b710ce36105388190" alt="ODBC Data Source Administrator showing ClickHouse drivers in the Drivers tab" border width="1168" height="842" data-path="images/integrations/data-visualization/powerbi_odbc_verify.webp" />

<br />

<h3 id="find-the-clickhouse-connector">
  Find the ClickHouse Connector
</h3>

<Note>
  Available in version `2.137.751.0` of Power BI Desktop
</Note>

On the Power BI Desktop start screen, click "Get Data".

<Image size="md" img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/svLCKm9RWi4jibqG/images/integrations/data-visualization/powerbi_get_data.webp?fit=max&auto=format&n=svLCKm9RWi4jibqG&q=85&s=b44629c65c82c46728c4d2a1d7d2b726" alt="Power BI Desktop home screen showing the Get Data button" border width="1916" height="968" data-path="images/integrations/data-visualization/powerbi_get_data.webp" />

<br />

Search for "ClickHouse"

<Image size="md" img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/svLCKm9RWi4jibqG/images/integrations/data-visualization/powerbi_search_clickhouse.webp?fit=max&auto=format&n=svLCKm9RWi4jibqG&q=85&s=9e1730ed423dfde3ce9844ed56174490" alt="Power BI Get Data dialog with ClickHouse searched in the search bar" border width="680" height="661" data-path="images/integrations/data-visualization/powerbi_search_clickhouse.webp" />

<br />

<h3 id="connect-to-clickhouse">
  Connect to ClickHouse
</h3>

Select the connector, and enter in the ClickHouse instance credentials:

* Host (required) - Your instance domain/address. Make sure to add it with no prefixes/suffixes.
* Port (required) - Your instance port.
* Database - Your database name.
* Options - Any ODBC option as listed
  in [ClickHouse ODBC GitHub Page](https://github.com/ClickHouse/clickhouse-odbc#configuration)
* Data Connectivity mode - DirectQuery

<Image size="md" img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/svLCKm9RWi4jibqG/images/integrations/data-visualization/powerbi_connect_db.webp?fit=max&auto=format&n=svLCKm9RWi4jibqG&q=85&s=69f639996bf6e0657dda9ecef24e45cd" alt="ClickHouse connection dialog showing host, port, database and connectivity mode fields" border width="694" height="364" data-path="images/integrations/data-visualization/powerbi_connect_db.webp" />

<br />

<Note>
  We advise selecting DirectQuery for querying ClickHouse directly.

  If you have a use case that has a small amount of data, you can choose import mode, and the entire data will be loaded to Power BI.
</Note>

* Specify username and password

<Image size="md" img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/svLCKm9RWi4jibqG/images/integrations/data-visualization/powerbi_connect_user.webp?fit=max&auto=format&n=svLCKm9RWi4jibqG&q=85&s=54dbf636166c904735a663e477812894" alt="ClickHouse connection credentials dialog for username and password" border width="700" height="276" data-path="images/integrations/data-visualization/powerbi_connect_user.webp" />

<br />

<h3 id="query-and-visualise-data">
  Query and Visualise Data
</h3>

Finally, you should see the databases and tables in the Navigator view. Select the desired table and click "Load" to
import the data from ClickHouse.

<Image size="md" img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/svLCKm9RWi4jibqG/images/integrations/data-visualization/powerbi_table_navigation.webp?fit=max&auto=format&n=svLCKm9RWi4jibqG&q=85&s=20550f1a5539ba249e79c65ee49c0f55" alt="Power BI Navigator view showing ClickHouse database tables and sample data" border width="873" height="691" data-path="images/integrations/data-visualization/powerbi_table_navigation.webp" />

<br />

Once the import is complete, your ClickHouse Data should be accessible in Power BI as usual.

<br />

<h2 id="power-bi-service">
  Power BI service
</h2>

In order to use Microsoft Power BI Service, you need to create an [on-premise data gateway](https://learn.microsoft.com/en-us/power-bi/connect-data/service-gateway-onprem).

For more details on how to setup custom connectors, please refer to Microsoft's documentation on how to [use custom data connectors with an on-premises data gateway](https://learn.microsoft.com/en-us/power-bi/connect-data/service-gateway-custom-connectors).

<h2 id="odbc-driver-import-only">
  ODBC driver (import only)
</h2>

We recommend using the ClickHouse Connector that uses DirectQuery.

Install the [ODBC Driver](#install-the-odbc-driver) onto the on-premise data gateway instance and [verify](#verify-odbc-driver) as outlined above.

<h3 id="create-a-new-user-dsn">
  Create a new User DSN
</h3>

When the driver installation is complete, an ODBC data source can be created. Search for ODBC in the Start menu and select "ODBC Data Sources (64-bit)".

<Image size="md" img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/svLCKm9RWi4jibqG/images/integrations/data-visualization/powerbi_odbc_search.webp?fit=max&auto=format&n=svLCKm9RWi4jibqG&q=85&s=f60cfc405ca82d22b0e4e72365d3f686" alt="Windows search showing ODBC Data Sources (64-bit) option" border width="826" height="676" data-path="images/integrations/data-visualization/powerbi_odbc_search.webp" />

<br />

We need to add a new User DSN here. Click "Add" button on the left.

<Image size="md" img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/svLCKm9RWi4jibqG/images/integrations/data-visualization/powerbi_add_dsn.webp?fit=max&auto=format&n=svLCKm9RWi4jibqG&q=85&s=05a20f28cc3d7377eea80de3ef9477cc" alt="ODBC Data Source Administrator with Add button highlighted for creating new DSN" border width="585" height="420" data-path="images/integrations/data-visualization/powerbi_add_dsn.webp" />

<br />

Choose the Unicode version of the ODBC driver.

<Image size="md" img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/svLCKm9RWi4jibqG/images/integrations/data-visualization/powerbi_select_unicode.webp?fit=max&auto=format&n=svLCKm9RWi4jibqG&q=85&s=15161c77369c7331426209d92f01d41f" alt="Create New Data Source dialog showing ClickHouse Unicode Driver selection" border width="458" height="353" data-path="images/integrations/data-visualization/powerbi_select_unicode.webp" />

<br />

Fill in the connection details.

<Image size="sm" img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/svLCKm9RWi4jibqG/images/integrations/data-visualization/powerbi_connection_details.webp?fit=max&auto=format&n=svLCKm9RWi4jibqG&q=85&s=2f84a4dc9dd1bfbd12eeeb5a37c26318" alt="ClickHouse ODBC Driver configuration dialog with connection parameters" border width="288" height="441" data-path="images/integrations/data-visualization/powerbi_connection_details.webp" />

<br />

<Note>
  If you're using a deployment that has SSL enabled (e.g. ClickHouse Cloud or a self-managed instance), in the `SSLMode` field you should supply `require`.

  * `Host` should always have the protocol (i.e. `http://` or `https://`) omitted.
  * `Timeout` is an integer representing seconds. Default value: `30 seconds`.
</Note>

<h3 id="get-data-into-power-bi">
  Get data into Power BI
</h3>

In case you don't have Power BI installed
yet, [download and install Power BI Desktop](https://www.microsoft.com/en-us/download/details.aspx?id=58494).

On the Power BI Desktop start screen, click "Get Data".

<Image size="md" img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/svLCKm9RWi4jibqG/images/integrations/data-visualization/powerbi_get_data.webp?fit=max&auto=format&n=svLCKm9RWi4jibqG&q=85&s=b44629c65c82c46728c4d2a1d7d2b726" alt="Power BI Desktop home screen showing the Get Data button" border width="1916" height="968" data-path="images/integrations/data-visualization/powerbi_get_data.webp" />

<br />

Select "Other" -> "ODBC".

<Image size="md" img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/svLCKm9RWi4jibqG/images/integrations/data-visualization/powerbi_select_odbc.webp?fit=max&auto=format&n=svLCKm9RWi4jibqG&q=85&s=feea92ddf39006c1f4e3462753d6d20c" alt="Power BI Get Data dialog with ODBC option selected under the Other category" border width="590" height="648" data-path="images/integrations/data-visualization/powerbi_select_odbc.webp" />

<br />

Select your previously created data source from the list.

<Image size="md" img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/svLCKm9RWi4jibqG/images/integrations/data-visualization/powerbi_select_dsn.webp?fit=max&auto=format&n=svLCKm9RWi4jibqG&q=85&s=c1afeb52503023dec44ed975eb178aa1" alt="ODBC driver selection dialog showing the configured ClickHouse DSN" border width="697" height="216" data-path="images/integrations/data-visualization/powerbi_select_dsn.webp" />

<br />

<Note>
  If you didn't specify credentials during the data source creation, you will be prompted to specify username and password.
</Note>

<Image size="md" img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/svLCKm9RWi4jibqG/images/integrations/data-visualization/powerbi_dsn_credentials.webp?fit=max&auto=format&n=svLCKm9RWi4jibqG&q=85&s=7c2ebdc5e8441109be722803bdd7d98d" alt="Credentials dialog for the ODBC DSN connection" border width="697" height="342" data-path="images/integrations/data-visualization/powerbi_dsn_credentials.webp" />

<br />

Finally, you should see the databases and tables in the Navigator view. Select the desired table and click "Load" to import the data from ClickHouse.

<Image size="md" img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/svLCKm9RWi4jibqG/images/integrations/data-visualization/powerbi_table_navigation.webp?fit=max&auto=format&n=svLCKm9RWi4jibqG&q=85&s=20550f1a5539ba249e79c65ee49c0f55" alt="Power BI Navigator view showing ClickHouse database tables and sample data" border width="873" height="691" data-path="images/integrations/data-visualization/powerbi_table_navigation.webp" />

<br />

Once the import is complete, your ClickHouse Data should be accessible in Power BI as usual.

<h2 id="optimizing-work-with-large-datasets">
  Optimizing work with large datasets
</h2>

PowerBI is designed for traditional row-based databases with moderate data volumes. When working with ClickHouse at scale (billions of rows), specific architectural patterns are required for optimal performance.

PowerBI automatically generates SQL queries with nested subqueries, complex joins, and on-the-fly transformations. These patterns work well with traditional SQL databases but can be inefficient when querying large-scale columnar databases like ClickHouse at scale.

**Recommended approach for large datasets:** Instead of querying raw tables directly, create dedicated `materialized views` in ClickHouse for each dashboard visualization. This gives you:

* Consistent, fast performance regardless of data volume
* Lower load on your ClickHouse cluster
* More predictable costs

<Warning>
  If your dashboards are slow, check ClickHouse's [`query_log`](/reference/system-tables/query_log) to see what SQL queries Power BI is actually running. Common problems include nested subqueries, scanning entire tables, or inefficient joins. Once you identify the issue, create [materialized views](/concepts/features/materialized-views/index) that solve those specific problems.
</Warning>

<h3 id="implementation-best-practices">
  Implementation best practices
</h3>

<h4 id="pre-aggregation-strategy">
  Pre-aggregation strategy
</h4>

Create materialized views at multiple aggregation levels:

* Hourly aggregations for recent, detailed dashboards
* Daily aggregations for historical trends
* Monthly rollups for long-term reporting
* Keep raw data with appropriate TTL for ad-hoc analysis

<h4 id="data-modelling-optimization">
  Data modelling optimization
</h4>

* Define `ORDER BY` keys that match your query patterns
* Use partitioning for time-series data
* Convert small dimension tables to dictionaries for efficient lookups
* Leverage projections for additional query optimization

<h2 id="known-limitations">
  Known limitations
</h2>

<h3 id="uint64">
  UInt64
</h3>

Unsigned integer types such as UInt64 or bigger won't be loaded into the dataset automatically, as Int64 is the maximum whole number type support by Power BI.

<Note>
  To import the data properly, before hitting the "Load" button in the Navigator, click "Transform Data" first.
</Note>

In this example, `pageviews` table has a UInt64 column, which is recognized as "Binary" by default.
"Transform Data" opens Power Query Editor, where we can reassign the type of the column, setting it as, for example,
Text.

<Image size="md" img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/svLCKm9RWi4jibqG/images/integrations/data-visualization/powerbi_16.webp?fit=max&auto=format&n=svLCKm9RWi4jibqG&q=85&s=ffc495fc71bc4ac22ad1a3ede913d172" alt="Power Query Editor showing data type transformation for UInt64 column" border width="1203" height="863" data-path="images/integrations/data-visualization/powerbi_16.webp" />

<br />

Once finished, click "Close & Apply" in the top left corner, and proceed with loading the data.
