How to Connect SQL Server to Power BI Desktop
Connect SQL Server with Home → Get data → SQL Server, enter the server, choose Import (copy into the model) or DirectQuery (live queries), pick tables in Navigator, then Load or Transform — that is the whole beginner path.
Friends! Excel is comfortable; SQL Server is where many company facts actually live. Why learn this carefully? Because the Import vs DirectQuery click is easy to rush and hard to undo casually. How? We walk Get data → mode → Navigator with a fictional FreshBasket warehouse database. Slow and clear.
मित्रांनो! Excel is comfortable; SQL Server is where many company facts actually live. Why learn this carefully? Because the Import vs DirectQuery click is easy to rush and hard to undo casually. How? We walk Get data → mode → Navigator with a fictional FreshBasket warehouse database. Slow and clear.
मित्रों! Excel is comfortable; SQL Server is where many company facts actually live. Why learn this carefully? Because the Import vs DirectQuery click is easy to rush and hard to undo casually. How? We walk Get data → mode → Navigator with a fictional FreshBasket warehouse database. Slow and clear.
Quick answer
Vertical checklist:
- Home → Get data → SQL Server.
- Enter server (and optional database).
- Choose Import or DirectQuery.
- Authenticate with the account your DBA gave you.
- Tick tables/views in Navigator.
- Transform data if types need fixing; otherwise Load.
Get data → SQL Server → Import | DirectQuery → Navigator → Load
Why SQL, what happens after you click
A shop that sells in Mumbai and Nashik may keep orders in Excel at first. Real companies often keep the same facts in SQL Server.
Tiny picture:
| Order ID | City | Amount |
|---|---|---|
| A | Mumbai | 100 |
| B | Mumbai | 40 |
| C | Nashik | 80 |
- Those three rows live in
FreshBasketDBon a company SQL Server. - When you choose Import, Power BI copies them into your model. A card can show Mumbai 140 offline.
- When you choose DirectQuery, the rows stay in SQL. Each visual asks SQL again. Freshness is higher. Your laptop talks more.
- Navigator is the window where you tick
SalesandCustomerbefore Load.
Why you care:
- Finance and ops systems often land in SQL first.
- Refresh and governance talk about databases, not only Excel dumps.
- The storage mode choice starts on this dialog.
SQL Server path: Get data → SQL Server → enter server (and database) → pick Import or DirectQuery → Navigator → Load or Transform.
मित्रांनो — SQL Server path: Get data → SQL Server → enter server (and database) → pick Import or DirectQuery → Navigator → Load or Transform.
मित्रों — SQL Server path: Get data → SQL Server → enter server (and database) → pick Import or DirectQuery → Navigator → Load or Transform.
What do I need before this guide?
- Desktop installed; basic Get data comfort (Excel/CSV guide).
- Permission to read a SQL database (lab or work).
- Course: Connecting to Microsoft SQL Server.
Before and after (look at the tables first)
Before
आधी (Before)
पहले (Before)
After
नंतर (After)
बाद में (After)
Import copies rows into the model (here Year = 2025 → 140). DirectQuery leaves data in SQL and queries live — pick based on size and freshness.
Step-by-step connection (classroom pace)
1) Open the connector
- Home → Get data.
- Select SQL Server database (More… → Database if needed).
2) Server box
- Type the server name your admin provided (
HOSTorHOST\\INSTANCE). - Optional: database name to skip hunting later.
- Advanced options → SQL statement only when you truly need a custom query.
3) Import vs DirectQuery (the fork)
Import copies tables into the model; DirectQuery leaves data in SQL Server and sends queries live.
मित्रांनो — Import copies tables into the model; DirectQuery leaves data in SQL Server and sends queries live.
मित्रों — Import copies tables into the model; DirectQuery leaves data in SQL Server and sends queries live.
- Import — Power BI copies tables into the model. Fast visuals; refresh to update.
- DirectQuery — data stays in SQL Server; visuals send queries live.
Beginners: prefer Import for learning unless your tutor says otherwise.
What happens with our tiny table:
- Import → Mumbai card shows 140 from the model copy.
- Someone inserts a new Mumbai order of 10 in SQL.
- Import report still shows 140 until refresh.
- DirectQuery report can show 150 on the next visual query (if the DB allows it).
4) Credentials
- Windows / Database / Microsoft account — match your environment.
- Wrong password looks like “empty Navigator” or hard failures — fix auth before reshaping M.
5) Navigator
Navigator shows databases and tables/views; tick what you need, then Transform data to shape before the model.
मित्रांनो — Navigator shows databases and tables/views; tick what you need, then Transform data to shape before the model.
मित्रों — Navigator shows databases and tables/views; tick what you need, then Transform data to shape before the model.
- Expand the database.
- Tick fact and dimension tables you need (start small).
- Preview a few rows — confirm Amount looks like money, not text.
- Transform data to set types; Load when clean enough.
Import vs DirectQuery — decision lines
- Training laptop + sample DB → Import.
- Multi-million-row warehouse + need freshness → consider DirectQuery.
- Need full DAX freedom and speed → Import usually wins.
- Mixed models (Dual) → next guide; master one mode first.
Gateway note (Service later)
- Desktop on the office network can often see SQL directly.
- The Power BI Service talking to on-premises SQL usually needs an on-premises data gateway.
- Do not panic on day one — connect in Desktop first.
Mistakes and calm fixes
| Symptom | Likely cause | Fix |
|---|---|---|
| Cannot find server | VPN / firewall / typo | Confirm server string in SSMS first |
| Login failed | Wrong auth mode | Match Windows vs SQL auth with DBA |
| Navigator empty | No permission / wrong DB | Request read rights; pick correct catalog |
| Visuals slow (DQ) | Heavy visuals + live SQL | Simplify measures; consider Import |
| Folding surprises | Native SQL / complex M | Prefer table select; learn folding later |
Ghabru naka 😅 — if SSMS fails with the same account, Power BI is not the villain.
Ravindra Bagale's Tip
Many students pick DirectQuery because it sounds “more professional”, then fight slow slicers all week. Start Import for learning. Switch when size or freshness truly forces you. Do not forget — mode is a design choice, not a badge.
Ravindra Bagale's Tip – मराठी
बरेच students DirectQuery निवडतात कारण ते “more professional” वाटते, मग आठवडाभर slow slicers शी झगडतात. शिकण्यासाठी Import ने सुरू करा. Size किंवा freshness खरोखर भाग पाडेल तेव्हा बदला. विसरू नका — mode ही design choice आहे, badge नाही.
Ravindra Bagale's Tip – हिंदी
बहुत students DirectQuery चुनते हैं क्योंकि वो “more professional” लगता है, फिर हफ्ते भर slow slicers से लड़ते हैं. सीखने के लिए Import से शुरू करो. Size या freshness सच में मजबूर करे तब बदलो. मत भूलो — mode design choice है, badge नहीं.
Practice task
- Connect to a lab SQL database with Import.
- Load one fact and one dimension table.
- Create one card measure that shows a city total (like Mumbai 140 on sample data).
- Write three lines: why you chose Import for this lab.
- Skim the DirectQuery-in-practice course lesson without implementing yet.
Learn it properly
Course lessons:
- Connecting to Microsoft SQL Server
- DirectQuery in practice
- Import vs DirectQuery vs Live connection
- On-premises data gateway
Related guides: Import vs DirectQuery vs Dual · Excel/CSV
Got it? SQL path = Get data → server → Import or DirectQuery → Navigator → Load. Prefer Import while learning. Let's continue storage modes in depth.
समजलं का? SQL path = Get data → server → Import or DirectQuery → Navigator → Load. Prefer Import while learning. आता पुढे जाऊया storage modes in depth.
समझ में आया? SQL path = Get data → server → Import or DirectQuery → Navigator → Load. Prefer Import while learning. आगे बढ़ते हैं storage modes in depth.
Frequently asked questions
Import or DirectQuery for SQL?
Import for smaller/faster models and full DAX features; DirectQuery when data is huge or must stay near real time on the server.
Do I need a gateway?
On-premises SQL refreshing or live in the Service usually needs an on-premises data gateway. Desktop on the same network can often connect directly.
Can I write SQL in the connector?
Yes via Advanced options → SQL statement, but start with table selection; native SQL can limit folding and reuse.
Navigator is empty — why?
Wrong server name, firewall, permissions, or credentials. Test with SSMS or Azure Data Studio using the same account.
Mixed mode later?
Composite models can mix Import and DirectQuery; learn single-mode first (see the Import vs DirectQuery vs Dual guide).
Course lessons?
SQL Server connection and DirectQuery-in-practice lessons in the databases chapter.