T
Tech Town
Log InSign Up Free
← Back to Blog

June 28, 2025 · admin

Get Data from SQL Server


πŸ”— https://techtown.in/power-bi/getting-data/get-data-from-sql-server/
πŸ’― Optimized to match your uploaded image (showing server & database dropdowns) and provide real value.


πŸ› οΈ Get Data from SQL Server in Power BI (Dropdown, Import Mode, SQL Query)

πŸ“Œ You can easily connect Power BI Desktop to a SQL Server database to visualize live business data. The SQL Server connector supports both direct dropdown selection and custom queries.


πŸ”½ Step-by-Step: Connect Using Server & Database Dropdowns

The dialog box shown above allows you to:

  • Select a SQL Server instance from the Server dropdown
  • Select a specific database from the Database dropdown (optional)

Power BI auto-detects available SQL Servers on your network (if discoverable), making it easier to pick from the list rather than typing manually.


βš™οΈ Data Connectivity Modes

ModeDescription
βœ… ImportLoads a static copy of data into Power BI for fast performance
πŸ”„ DirectQueryConnects live to SQL Server and fetches data on each interaction

πŸ‘‰ Import is ideal for performance and offline work.
πŸ‘‰ DirectQuery is better for real-time dashboards with current data.


🧠 Tip: Use Import if your dataset is under a few million rows. For large/critical real-time dashboards, go for DirectQuery β€” but remember it may affect performance.


🧾 Optional: Use Advanced Options for SQL Queries

If you want more control, click Advanced options and paste a custom SQL statement. This lets you:

  • Join multiple tables in SQL
  • Apply WHERE, GROUP BY, ORDER BY
  • Limit results (TOP 1000 or use ROW_NUMBER() for pagination)

Example:

SELECT EMP_ID, NAME, SALARY
FROM dbo.Employees
WHERE DEPT = 'HR' AND SALARY > 50000

βœ… Power BI will treat this query as a virtual table and allow you to visualize it directly.


πŸ“‹ Use Case Examples

  • πŸ” Sales Analytics: Connect to SalesDB, import tables like Orders, Products
  • πŸ’Ό HR Dashboards: Use a query on EmployeeDB to fetch high-earning employees
  • πŸ“¦ Inventory Reports: Pull latest stock counts using DirectQuery

🧩 Merge with Other Sources

Once connected to SQL Server, you can combine it with:

  • Excel files (Merge Queries)
  • APIs (Web connector)
  • Power Platform (Dataverse, Power BI Datasets)

This creates a powerful data model that unifies multiple sources in one place.


πŸ“˜ Summary

Power BI’s SQL Server connector provides a clean and intuitive experience:

  • Dropdowns for Server & Database
  • Two flexible data modes (Import/DirectQuery)
  • Advanced SQL query support
  • Seamless integration with other data sources

It’s the best way to bridge your structured backend data into stunning, dynamic visuals.