Skip to main content

How to connect Power BI with PostgreSQL?

Microsoft’s Power BI is a popular data analysis and visualization tool. It allows data input from various databases, webpages, or structured files such as spreadsheets, CSV, XML, and JSON and helps you get meaningful insights with its data transformation and visualization features.

While it provides tens of data input options, establishing a connection between Power BI and PostgreSQL (a widely-used open-source database management system), is not exactly a cakewalk. If you have tried getting data in from PostgreSQL in Power BI, you would have most probably run into an error.

Error message while connecting Power BI and PostgreSQL

This is because connecting PostgreSQL to Power BI requires a certain additional setup. We will walk you through the common setups in this article today.

Connecting Power BI and PostgreSQL via ODBC

The quickest way you can connect Power BI and PostgreSQL is via ODBC (Open Database Connectivity). To do this,

  • Download the latest psqlODBC from the official site. After the zip is downloaded, extract all items from it. Now, to install the driver, double-click on the MSI file. In the succeeding dialog box(es) choose the defaults.
  • Now, sign in to your Power BI dashboard.
  • Click on the “Get data” option on the taskbar.

Get data option in PostgreSQL

  • Select “ODBC” from the given options. If you don’t see ODBC, search for it in the search bar.

A dialog box will pop open, with an option to choose your data source. Select None as the option, and enter the non-credential properties such as - Driver, Server, Port, and Database in the connection string.

Driver={PostgreSQL ANSI(x64)};; Port=5432; Database= example_database
  • Next, enter your database credentials and hit “Connect”. You’ll see the list of your views published as tables. Select the one you want to import and load it to Power BI.