Sign in or start a free trial to avail of this feature.
1. Connecting to a Database
Databases are common in most businesses, but connecting to them can be more difficult than connecting to simple files. In this lesson, we’ll learn how to connect to a PostGreSQL database hosted online.
Course Outline (00:03)
Many Power BI courses focus on connecting simple data sources like Excel files to Power BI. This course demonstrates how to connect to more advanced data sources. This course contains two main sections:
Connecting to a database and working with associated data
Connecting Excel directly to Power BI, using Analyze in Excel, and setting up scheduled refreshes
Lesson Goal (00:45)
The goal of this lesson is to connect to a database that contains information related to UK pharmaceutical data.
Connecting to a Database (01:02)
Power BI Desktop can connect to a wide variety of database types, using the Get Data option. To connect to a database, you need to provide certain information. For example, connecting to a PostgreSQL database, you need to provide the server where the database is found, and the name of the database.
Many databases give you the option to import the data or use DirectQuery. If you use Import, Power BI creates a copy of the database, and stores that copy in the workbook. This copy is then used when you want to create charts and visualizations. You need to manually refresh the connection to update the data stored in the workbook. If you use DirectQuery, Power BI creates a direct connection between the workbook and the database. Power BI queries the database directly any time we use its data in a visualization.
The main advantage of DirectQuery is that data is updated any time you update a visualization. The main disadvantage is that frequently querying a database can be slow, especially if the database is large.
In our case, we connect to a database stored locally in a Microsoft Access file. After connecting to this database, the navigator window will display a list of all the tables in the database. You can preview a table by selecting it from this list. Generally, a database contains many tables, and you’ll want to select only a small number of them to analyze.