MSDN Tutorials

Your guide to Microsoft Technologies

Connecting Data to Power BI

This tutorial will guide you through the essential steps of connecting to various data sources and importing them into Power BI Desktop.

Why Connect Data?

Power BI's power lies in its ability to consolidate and analyze data from disparate sources. Connecting to your data is the first and most crucial step in building insightful reports and dashboards.

Supported Data Sources

Power BI supports a wide range of data sources, including:

Step 1: Open Power BI Desktop

Launch the Power BI Desktop application on your Windows machine.

Step 2: Access the "Get Data" feature

On the 'Home' tab of the Power BI Desktop ribbon, you will find the "Get Data" button. Clicking this button opens a dropdown menu of common data sources, or you can select "More..." to see the full list of available connectors.

Get Data button in Power BI Desktop

Step 3: Select Your Data Source

Browse through the categories or use the search bar to find the specific data source you want to connect to. For example, if you want to connect to an Excel file, select "Excel Workbook" under the 'File' category.

Step 4: Provide Connection Details

Depending on the data source, you will be prompted to provide connection details. This might include:

Tip: Ensure you have the necessary permissions and credentials before attempting to connect to a data source.

Step 5: Navigate and Select Data

Once connected, a "Navigator" window will appear. Here, you can see the tables, sheets, or views available within your data source. Select the specific items you want to import into Power BI.

Navigator window in Power BI

Step 6: Load or Transform Data

You have two primary options:

We'll explore data transformation in a subsequent tutorial.

Connecting to a SQL Server Database Example

Let's walk through connecting to a SQL Server database:

  1. Click "Get Data" > "More...".
  2. Select "SQL Server database" from the list.
  3. In the dialog box, enter the Server name and optionally the Database name.
  4. Choose your Data Connectivity mode (Import or DirectQuery). For beginners, 'Import' is often easier.
  5. Click "OK".
  6. You may be prompted to enter credentials. Select the appropriate authentication method and provide your details.
  7. Click "Connect".
  8. The Navigator window will appear, allowing you to select tables or views.

-- Example SQL Query (if using advanced query option)
SELECT
    [CustomerID],
    [FirstName],
    [LastName],
    [Email]
FROM
    [SalesLT].[Customer]
WHERE
    [ModifiedDate] > '2023-01-01'
            

Tip: Understanding your data's structure and the relationships between tables is crucial for effective data modeling.

Warning: DirectQuery mode queries the data source in real-time. Performance depends heavily on the data source's speed and network latency. For large datasets or complex reports, consider importing the data.

Next Steps

Now that you've successfully connected to your data, you're ready to start shaping and modeling it. The next tutorial will cover "Transforming and Cleaning Data with Power Query".