By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.
(Excel, SQL, Web, SharePoint – Production-Ready & Exam-Proof)
You’re building a Power BI report for your sales team. The data lives in four places: - Excel files (daily sales dumps from a legacy system).- SQL Server (ERP database with customer orders).- A public API (weather data to correlate with sales).- SharePoint (team documents with manual adjustments).
If you don’t connect to these sources correctly, your report will: ❌ Break when the Excel file moves.❌ Time out on large SQL queries.❌ Fail to refresh when the API rate-limits you.❌ Show stale data because SharePoint permissions are misconfigured.
This guide gives you the superpower to:✅ Pull data reliably (no more "file not found" errors).✅ Optimize performance (avoid 10-minute refreshes on 100K rows).✅ Secure credentials (no hardcoded passwords in PBIX files).✅ Automate refreshes (so your boss sees yesterday’s data, not last month’s).
Real-world scenario:You inherit a Power BI report that "works" but: - The Excel file path is hardcoded to C:\Users\Bob\Desktop\Sales.xlsx.- The SQL query runs in 20 seconds on your laptop but times out in the Power BI Service.- The SharePoint connection uses a personal account that’s about to be deactivated.
C:\Users\Bob\Desktop\Sales.xlsx
Your mission: Fix it before the next board meeting.
.xlsx
.csv
SQL_Server = "prod-db" vs "dev-db"
Sales.xlsx
C:\Data\Sales.xlsx
Sales_Excel
https://yourcompany.sharepoint.com/sites/Sales/Shared%20Documents/Sales.xlsx
powerquery-m let Source = SharePoint.Files("https://yourcompany.sharepoint.com/sites/Sales", [ApiVersion = 15]), File = Source{[Name="Sales.xlsx"]}[Content], Import = Excel.Workbook(File) in Import
your-server.database.windows.net
localhost
AdventureWorks
sql SELECT OrderID, CustomerID, OrderDate, TotalAmount FROM Sales.Orders WHERE OrderDate >= DATEADD(YEAR, -1, GETDATE())
Sales_SQL
CALCULATE
https://jsonplaceholder.typicode.com/users
Users_API
?page=1
powerquery-m (page as number) => let Source = Json.Document(Web.Contents("https://api.example.com/users?page=" & Text.From(page))), Data = Source[data] in Data
https://yourcompany.sharepoint.com/sites/Sales
Sales_Adjustments_SharePoint
WHERE OrderDate > '2023-01-01'
LastModifiedDate
Only pull the columns you need. Example: ```sql -- Bad SELECT * FROM Sales.Orders
-- Good SELECT OrderID, CustomerID, OrderDate FROM Sales.Orders ```
Excel_Path = "https://..."
SQL_Server = "prod-db"
SQL_Sales
Excel_Inventory
Sales_Orders
Sales Orders
C:\Users\<user>\AppData\Local\Microsoft\On-premises data gateway\
WHERE
❌ Import Mode (not real-time).
"How do you secure SQL credentials in Power BI?"
❌ Hardcode in M code (security fail).
"What’s the best way to handle a 10GB Excel file?"
❌ Load the entire file (will crash Power BI).
"How do you refresh a SharePoint list in Power BI Service?"
You have an Excel file (Sales.xlsx) with 500K rows. The report refreshes slowly, and the file path is hardcoded to C:\Data\Sales.xlsx. Fix it so:1. The file path is dynamic (works on any machine).2. Only the last 30 days of data are loaded (for performance).
powerquery-m = Table.SelectRows(Source, each [OrderDate] >= Date.AddDays(DateTime.LocalNow(), -30))
Excel_Path
Excel.Workbook(Web.Contents(Excel_Path))
Why it works:- SharePoint/OneDrive paths are cloud-based (no local dependencies).- Filtering before loading reduces data volume.- Parameters make the report portable across environments.
C:\Data\file.xlsx
Function.InvokeAfter
Table.SelectRows(Source, each [Date] >= Date.AddDays(DateTime.LocalNow(), -30))
(page) => Json.Document(Web.Contents("https://api.com?page=" & Text.From(page)))
Folder.Files("C:\Data")
✅ All file paths are parameterized (no hardcoded C:\ paths).✅ SQL queries use query folding (filters/sorts in the source).✅ APIs handle pagination/rate limits (no "429 Too Many Requests").✅ SharePoint uses a service account (not a personal account).✅ Incremental refresh is set up (for large tables).✅ Gateway is installed on a server (not a laptop).✅ Credentials are stored securely (no hardcoded passwords).✅ Refresh schedule is configured (daily/hourly as needed).✅ Email alerts are set for failures (so you know before your boss does).
C:\
Now go build something awesome. ?
Join 4M+ learners. Unlock unlimited quizzes, wrong-answer tracking, flashcards + reminders, study guides, and 1-on-1 challenges.