How to Get Data from SQL Server in Power BI

Cody Schneider8 min read

Getting your SQL Server data into Power BI is the first step to creating reports that can truly transform how you see your business. This isn’t a complicated process reserved for database administrators, with a few clicks, you can link directly to your server and start visualizing information. This guide will walk you through every step of connecting SQL Server to Power BI, explaining the most important choices you’ll make along the way.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Before You Begin: A Quick Checklist

To make the connection process as smooth as possible, it helps to have a few pieces of information ready before you start. It’s like gathering your ingredients before you start cooking - it just makes everything easier. Here’s what you’ll need:

  • Power BI Desktop: You'll need the free Power BI Desktop application installed on your Windows computer. If you don't have it yet, you can download it directly from the Microsoft Store.
  • Server Name: This is the address of your SQL Server instance. It might look something like YourServerName\SQLEXPRESS, a dedicated IP address, or a domain name provided by your IT department.
  • Database Name (Optional but Recommended): This is the specific database within the server you want to connect to. While listing the database is optional at the start, providing it makes the process quicker by narrowing down the focus right away.
  • Your Credentials: You need permission to access the database. This could be your standard Windows user login (if your company uses Windows Authentication) or a specific username and password for the SQL Server database itself. If you're not sure which you need, your IT administrator or database manager will know.

Once you have this information handy, you’re ready to connect.

Connecting Power BI to SQL Server: The Step-by-Step Guide

With your details in hand, let's walk through the exact steps to link Power BI directly to your SQL database.

Step 1: Open Power BI and Select ‘Get Data’

Launch Power BI Desktop. On the Home ribbon at the top of the screen, you'll see a prominent button labeled Get Data. Click on it. A drop-down menu with common data sources will appear. You can select SQL Server directly from this list if you see it, or you can click "More..." at the bottom to open the full list of connectors.

If you open the full list, you can either select "Database" from the categories on the left and then choose "SQL Server database," or simply type "SQL" into the search bar. Click "Connect" to proceed.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Step 2: Enter Your SQL Server Details

A new window titled "SQL Server database" will pop up, asking for the server and database details you gathered earlier.

  • In the Server field, type or paste the server name exactly as you have it.
  • In the Database (optional) field, enter the name of the database you want to access. Again, this isn't strictly required, but it saves you time from browsing through all the databases on the server if you already know which one you need.

Step 3: Choosing Between Import and DirectQuery

This is easily the most important decision you'll make during the setup process. Below the server and database fields, you’ll see the "Data Connectivity mode" with two options: Import and DirectQuery. Your choice here affects report performance, data freshness, and what you’re able to do in Power BI.

What is Import Mode?

Import mode copies the data from your SQL Server and loads it into your Power BI file (.pbix). Think of it like taking a snapshot or a photocopy of your data at a specific moment in time. When a user interacts with your report, they are interacting with this cached copy of the data via a high-speed, in-memory engine inside Power BI.

  • Pros:
  • Cons:

What is DirectQuery Mode?

DirectQuery mode does not copy the data into your Power BI file. Instead, it creates a live, direct connection to your SQL Server. Every time you interact with a visual - like clicking a filter or opening a dashboard - Power BI sends a new query back to the SQL Server to retrieve the latest data.

  • Pros:
  • Cons:

Which One Should You Choose?

Here’s a simple rule of thumb: Always start with Import mode unless you have a specific reason to use DirectQuery.

If your dataset is under a few million rows and doesn't need to be updated in real time (e.g., refreshing once a day or a few times a day is fine), Import mode will give you a much faster and more flexible user experience. This covers the vast majority of business reporting scenarios.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Step 4: Authenticate Your Connection

After clicking "OK," Power BI will ask for your credentials to log in to the database. You'll see several options on the left:

  • Windows: Use this if you log in to the database with your current Windows user account (common in corporate environments). You can typically just click "Connect."
  • Database: Use this if you have a specific username and password for the SQL Server. Enter them in the fields provided.
  • Microsoft account: This is for connecting to Azure SQL databases using your Microsoft/Azure AD credentials.

Choose the method your IT department specified, enter your credentials, and click Connect.

Step 5: Select Your Data with the Navigator

Once you’re successfully authenticated, the Navigator window will appear. This window shows you all the tables, views, and even functions available in the database you connected to. You can browse through and check the box next to any table or view that you want to bring into Power BI. Selecting a table in the list will show you a preview of its data on the right side.

At the bottom right of the Navigator, you’ll see two options:

  • Load: Click this if your data is already clean and well-structured. Power BI will load the selected tables directly into your data model.
  • Transform Data: This is the more common choice. Clicking it will open the Power Query Editor, where you can clean, shape, and prepare your data before it gets loaded into your report. This is where you can remove unnecessary columns, change data types, filter out rows, and more.

Going Further: Practical Tips and Best Practices

You’ve now successfully connected to your SQL Server! Here are a few extra tips for getting the most out of your connection.

Tip 1: Write Custom SQL for Targeted Data Pulls

What if you don’t want to import an entire table? Maybe you only need specific columns or filtered rows. In the initial "SQL Server database" setup window, you’ll see an "Advanced options" section. You can expand that and paste a custom SQL statement directly.

For example, if you only want orders from the last year, you could write a query like this:

SELECT
    Order_ID,
    CustomerID,
    OrderDate,
    TotalAmount
FROM
    Sales.Orders
WHERE
    OrderDate >= '2023-01-01'

This tells Power BI to only pull the specific data returned by your query. It's an incredibly efficient way to work, as it reduces the amount of data being imported and offloads some of the filtering work to the powerful SQL Server.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Tip 2: Troubleshooting Common Connection Issues

Sometimes, connections fail. Here are the usual suspects:

  • Incorrect Server Name: Double-check for typos. This is the most common error.
  • Firewall Issues: A firewall on your computer or company network might be blocking the connection. You may need to ask your IT administrator to create a firewall rule allowing Power BI Desktop to access the SQL Server.
  • Permissions: The credentials you’re using may not have permission to read from the database. Verify with your database administrator that your account has at least db_datareader permissions.

Tip 3: A Quick Intro to Transforming Your Data

If you clicked "Transform Data" back in step 5, you've landed in the Power Query Editor. This is where the real magic of data preparation happens. You don't need to be a data scientist to use it. The interface is all visual clicks. You can easily:

  • Remove columns you don't need for your report.
  • Filter rows to remove irrelevant entries.
  • Change data types (e.g., making sure a date column is recognized as a date, not text).
  • Merge tables by joining them together, similar to a VLOOKUP in Excel.

Every change you make is recorded as a step in the "Applied Steps" pane on the right. This makes your data prep process repeatable and easy to edit later.

Final Thoughts

Connecting Power BI to your SQL Server database is a fundamental skill that opens up a world of reporting possibilities. By following the steps above and making an informed choice between Import and DirectQuery mode, you can turn raw database tables into clear, interactive, and decision-driving dashboards.

While directly connecting tools like Power BI offers a ton of control, we believe getting insights shouldn't require manual setup and technical know-how. We created Graphed to remove this friction by connecting all your data sources automatically and letting you build dashboards and ask questions using simple, natural language. It's like having a data analyst on your team who works in seconds, allowing you to get answers without having to configure connections or learn complex software.

Related Articles