Stop 02 · Connecting to DataTopics · 3/8

Connecting to SQL Server, MySQL and PostgreSQL

Part of the Power BI Roadmap

In short

Serious company data lives in databases, not spreadsheets. Connecting Power BI straight to the database means no more waiting for someone to export a file.

Power BI has connectors for most databases. You enter the server and database, pick tables in the Navigator, and can optionally paste a SQL statement under advanced options.

The jaadu shows a pass to a guard at a warehouse gate and then wheels a trolley between tall racks of numbered crates.

Think of it like this

Ordering straight from the godown

Instead of waiting for a shopkeeper to bring goods to the counter, you walk into the godown with the right gate pass (credentials), find the right rack (server and database) and pick the boxes you want (tables). Database connectors give Power BI that gate pass.

Watch it happen

Connecting to a SQL Server database

Server
Database
Sign in
Navigator
Power Query

1/5Enter the server name, for example sql-prod-01 or an Azure address like shop.database.windows.net.

The big ideas

What you need to know

Server plus database

Every database connector asks for at least a server address and usually a database name.

Drivers for some sources

SQL Server works out of the box. MySQL often needs the MySQL Connector/NET driver installed on the PC and on any gateway.

Query folding

Filters and column removals in Power Query are translated into SQL and run on the server, which is much faster.

Read-only accounts

Ask for a read-only reporting login. Power BI never needs permission to change data.

See it in code

Walk through the code

m
1let2    Source = Sql.Database("sql-prod-01", "ShopDB"),3    Orders = Source{[Schema = "dbo", Item = "Orders"]}[Data],4    Recent = Table.SelectRows(Orders, each [OrderDate] >= #date(2026, 1, 1)),5    Kept = Table.SelectColumns(Recent, {"OrderID", "CustomerID", "OrderDate", "Amount"})6in7    Kept8 9// PostgreSQL:  PostgreSQL.Database("pg-host:5432", "shopdb")10// MySQL:       MySQL.Database("mysql-host:3306", "shopdb")

1/4Sql.Database takes the server and the database name.

Connect to SQL Server and keep only 2026 orders and four columns. Both steps fold into a single SQL query on the server.

Save yourself the pain

Common mistakes

Oops

Loading every table in the database just in case.

Do this instead

Pick only the tables and columns the report needs. Smaller models refresh faster and are easier to understand.

Oops

Using your personal admin login in a report that will be shared.

Do this instead

Use a dedicated read-only reporting account, and store credentials in the gateway or Service, not in the file.

Your mission

Connect to a real database

~30 min

Quick check

You filter a SQL Server table in Power Query and View Native Query shows a WHERE clause. What does that tell you?

Go deeper

  1. 1Connect to a local database you set up while learning SQL.
  2. 2Install any driver the connector asks for, such as the MySQL connector.
  3. 3Load only the tables and columns you need.

More topics at this stop

Stuck on this topic? Ask an Insider

Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.

Download
InsideEdge