Skip to main content

Power BI

Microsoft Power BI can query data from Apache Doris and can also load data into memory. With Power BI Desktop, you can connect to an Apache Doris data source and create reports, dashboards, and visual analytics.

Starting from the user workflow, this article describes how to complete the following operations:

Use caseUser goalMain operations
Prepare the connection environmentEnable Power BI Desktop to connect to DorisInstall the MySQL ODBC driver and the Doris Power BI connector
Connect to a Doris data sourceAccess an Apache Doris instance from Power BI DesktopFill in the Doris Data Source, Database, authentication information, and data connectivity mode
Choose a query modeSelect a connection mode based on the data volume and the way you analyze dataUse DirectQuery to query Doris directly, or use Import to load a small amount of data into Power BI
Build a visualization dashboardBuild an analytics report based on TPC-H data in DorisCreate table relationships, drag and drop fields, and generate and save a dashboard

Prepare the connection environment

Install Power BI Desktop

This article assumes that you have already installed Microsoft Power BI Desktop on a Windows computer. If it is not installed, you can visit the Power BI Desktop download page to download and install it.

It is recommended to update Power BI Desktop to the latest version.

Prepare Doris connection information

Before connecting to Apache Doris, collect the following information:

ParameterMeaningExample
Doris Data SourceDatabase connection string in the format host:port127.0.1.28:9030
DatabaseDatabase nametest_db
Data Connectivity ModeData connectivity mode, including Import and DirectQueryDirectQuery
SQL StatementSQL statement, must include the database, only applicable in Import modeselect * from database.table
User NameUser nameadmin
PasswordPasswordxxxxxx

Install the MySQL ODBC driver

To connect to Doris in Power BI Desktop, you need to install the MySQL ODBC driver first.

Install the driver

  1. Download and install MySQL ODBC.

  2. Select and configure version 5.3.

  3. Run the downloaded .msi installer and follow the installation wizard to complete the installation.

After the installation is complete, the following screen appears.

Verify the driver

After the driver is installed, you can verify the installation as follows:

  1. In the Windows Start menu, type ODBC and select ODBC Data Sources (64-bit).

  1. Confirm that the MySQL driver appears in the driver list.

Install the Doris Power BI connector

The Power BI custom connector certification channel is currently closed, so the custom connector provided by Doris is an uncertified connector. For uncertified connectors, refer to the Power BI custom connector configuration documentation to complete the following configuration.

Place the connector file

  1. Assume that power_bi_path is the installation directory of Power BI Desktop on the Windows operating system. The default is usually:

    power_bi_path = C:\Program Files\Power BI Desktop
  2. Place the Doris.mez custom connector file under the %power_bi_path%\Custom Connectors folder path.

  3. If the path above does not exist, create it manually as needed.

Allow loading uncertified connectors

  1. In Power BI Desktop, select File.

  1. Select Options and settings > Options.

  1. On the Options screen, select GLOBAL > Security. Under Data Extensions, check (Not Recommended) Allow any extension to load without validation or warning to lift the restriction on uncertified connectors.

  1. Select OK and then restart Power BI Desktop.

Connect to Doris in Power BI Desktop

After installing the driver and connector, you can find the Doris connector in Power BI Desktop and create a Doris data source.

Find the Doris connector

  1. Launch Power BI Desktop.

  2. On the Power BI Desktop start screen, click New Report. If you already have a local report, you can also choose to open an existing report.

  1. Click Get Data and select the Doris database in the pop-up window.

Fill in connection information

After selecting the Doris connector, enter the Doris instance credentials:

ParameterRequiredDescription
Doris Data SourceRequiredDoris instance domain name, address, or host:port
DatabaseRequiredDoris database name
SQL statementOptionalSQL statement to execute beforehand, only available in Import mode
Data connectivity modeRequiredChoose DirectQuery or Import

Recommendations for choosing a connection mode:

ModeApplicable scenarioDescription
DirectQueryRecommended for querying Doris directlyPower BI does not load the full data set; instead, it sends queries directly to Doris
ImportSuitable for small data scenariosThe entire data set is loaded into Power BI
note

It is recommended to choose DirectQuery to query Doris directly. If your use case involves only a small amount of data, you can choose Import mode.

Enter user name and password

Specify the Doris user name and password.

Load the table schema and preview data

In the navigator view, you should be able to see databases and tables. Select the desired tables and click Load to load the table schema and preview data from Apache Doris.

After the import is complete, Doris data is accessible in Power BI as expected. You can then configure the statistical dashboard you need.

Build a visualization dashboard in Power BI

This example uses TPC-H data as the data source. For how to build the Doris TPC-H data source, refer to the Doris TPC-H Benchmark documentation.

Suppose you need to count order revenue across regions. You can build the dashboard with the following process.

Create table model relationships

  1. Click Model view to enter the table model relationship configuration screen.

  1. Drag the four tables customer, nation, orders, and region onto the same screen as needed, and then drag the related fields to connect them.

The relationships among the four tables are as follows:

Source tableSource fieldTarget tableTarget field
customerc_nationkeynationn_nationkey
customerc_custkeyorderso_custkey
nationn_regionkeyregionr_regionkey
  1. After the relationships are set up, the result is as follows.

Configure the order revenue dashboard

  1. Return to the Report view workspace and start building the dashboard.

  2. Drag o_totalprice from the orders table onto the dashboard.

  1. Drag r_name from the region table to the X column.

  1. The expected dashboard content is now displayed.

  1. Click the save button in the upper-left corner of the workspace to save the created statistical dashboard locally.

At this point, you have successfully connected Power BI to Apache Doris and completed data analysis and visualization dashboard creation.