Use Power BI Desktop’s SQL Server connector to import or query data from an on-prem or Azure SQL Server database for interactive reporting.
Direct connectivity removes CSV exports and keeps dashboards live. Scheduled refreshes or DirectQuery allow near-real-time views of Orders, Customers, and revenue.
Open Power BI Desktop → Get Data → SQL Server. Enter server name, optional database, and choose Import or DirectQuery. Provide credentials (Windows, Database, Microsoft Entra).Click OK.
Use Windows for on-prem AD, Database for SQL logins, or Microsoft Entra for Azure SQL. Ensure the login has at least db_datareader
on the required database.
In Navigator, tick only Customers, Orders, Products, and OrderItems. Use Transform Data to apply row filters or rename columns before loading.
From the connector window, expand Advanced options, paste your T-SQL, and pick Import/DirectQuery.Power BI uses this query as the data source.
SELECT DATEFROMPARTS(YEAR(order_date), MONTH(order_date), 1) AS month_start, SUM(total_amount) AS monthly_revenueFROM OrdersGROUP BY DATEFROMPARTS(YEAR(order_date), MONTH(order_date), 1)ORDER BY month_start;
Publish the report to Power BI Service → Dataset settings → Scheduled refresh. Provide a gateway if the SQL Server is on-prem.
Select only needed columns, add indexes on Orders.order_date
and OrderItems.order_id
, and prefer Import for static data, DirectQuery for near-real-time.
.
Yes, create separate data sources or qualify objects with the database name inside a single custom query.
No. Gateways are only needed for on-prem SQL Server. Azure SQL connections refresh natively in the Power BI Service.