DEV Community

Cover image for From Zero to Dashboard: Connecting Power BI to PostgreSQL / SQL Databases
MashaFord
MashaFord

Posted on

From Zero to Dashboard: Connecting Power BI to PostgreSQL / SQL Databases

Connecting Power BI to a SQL database was one of the most important steps in building my dashboard. Instead of working with static Excel files, I connected directly to my PostgreSQL database on Aiven. This allowed me to pull live data, keep everything updated automatically, and create more dynamic and accurate visualizations. The process was surprisingly straightforward — I just needed the hostname, port, username, password, and database name, and Power BI handled the rest smoothly.Once connected, I could easily bring in the tables I needed, clean the data using Power Query, and start building measures and visuals right away. The best part is that I can now refresh the entire dashboard with a single click whenever new logistics data comes in. It made the whole project feel much more professional and scalable, like a real business intelligence solution rather than just another report.
Before connecting, below are the Essential Prerequisites MUSH HAVE to start it off.

  1. Power BI Desktop Installed (Latest Version) 2.Database Connections Details-Server / Hostname (127.0.0.1) Port (default 5432) Database Name Username Password
  2. Aiven Console (connected to PostgreSQL)
  3. Dbeaver( Download from Microsoft) STEP 1. Dbeaver setup a) Create a New Connection Open DBeaver → Click the plug icon (New Connection) b) Select PostgreSQL → Next c) Enter connection details:Host,Aiven hostname d) Port: 5432 (default for Postgres) Database: Your database name Username and Password. see below snip

Now Test Connection (this is very important!)
once successful, click Finish


Create a Schema (e.g, JCARS)


On the postgresql database, click on the schema alredy created and import the data.

STEP 2: Step 2: Connect local database to PowerBi
Now that the database is set up (either locally or on Aiven), lets connect it to Power BI Desktop:
a) Open Power BI Desktop and click on Get Data (Home tab) → Choose Database.
b) Select the database type,in this case its PostgreSQL database.
c) Enter the Connection Details:Server: For a local database, type localhost (127.0.0.1)
Port : 5432 for PostgreSQL
Database: Enter the name of your local database

Enter name on the local database

IF you had not connected to the CA certificate, it will be bring an error, this is easily solved by downloading the certificate from Aiven


Once downloaded, go to manage certificates on the search tab on the PC, click on the trusted root certification- certifattes- All tasks and import, see below snip


Now you need to Close the POWERBI and imput the details again. It will definately connect with ease.

In conclusion, Connecting Power BI to a SQL database was honestly one of the most valuable parts.Once I got the connection working — entering the hostname, port, credentials, and choosing the right tables — the whole dashboard came alive. Being able to refresh data with one click and see real-time insights completely changed how the logistics information could be used.
Lastly, learning to connect Power BI directly to SQL databases made me realize how much more powerful reports can become when they’re not limited to Excel files.

Top comments (0)