Power BI Course
Refresh Schedules and the On-Premises Data Gateway
A report that never refreshes is a historical document. A report that refreshes but fails silently is worse — it shows stale data that users trust as current. This lesson covers everything that happens after you click Publish: how scheduled refresh works, when you need a gateway and how to configure one, incremental refresh for large tables, and the complete troubleshooting toolkit for when refresh fails.
How Scheduled Refresh Works
When a scheduled refresh runs, the Power BI Service re-executes all enabled Power Query queries in the dataset and reloads the results into the VertiPaq column store. The existing data is replaced with fresh data from the source. All reports connected to the dataset automatically show the new data on the next page load — no user action required.
The On-Premises Data Gateway
The Power BI Service lives in Microsoft's cloud and cannot directly reach a database or file on your internal network. The On-Premises Data Gateway is a lightweight Windows application you install on a machine inside your network. It acts as a secure bridge — the Service sends a refresh request to the Gateway, the Gateway connects to the local data source, retrieves the data, and sends it back to the Service encrypted.
// Installing and configuring the On-Premises Data Gateway
// Step 1 — Download the gateway installer
// Service → Settings (gear icon) → Manage gateways → Download gateway
// Or: microsoft.com → search "Power BI gateway download"
// Install on a machine that:
// - Is always powered on (not a laptop that gets closed)
// - Has network access to the data source (SQL Server, file share, etc.)
// - Has outbound HTTPS access to Azure Service Bus
// - Has 4+ GB RAM and a dual-core CPU minimum
// Step 2 — Register the gateway with the Service
// During installation, sign in with your Power BI account
// Give the gateway a name: "Corp-Gateway-01"
// Choose recovery key (store this securely — needed to restore)
// Step 3 — Add data sources to the gateway
// Service → Settings → Manage connections and gateways
// Find your gateway → "+ New" → Data source
// Data source type: SQL Server
// Server: corp-sql-01.internal.company.com
// Database: SalesDB
// Authentication: Windows (Kerberos) or Basic (username/password)
// Test the connection → Save
// Step 4 — Connect the dataset to the gateway
// Service → Dataset → Settings → Gateway connection
// Expand the gateway cluster → map each data source
// Data source in dataset → gateway data source
// corp-sql-01/SalesDB → Corp-Gateway-01 / SalesDB
// Click Apply
// Step 5 — Test with a manual refresh
// Dataset → Refresh now
// Monitor progress: Dataset → Refresh history → Latest entry
Gateway Modes — Standard vs Personal
Incremental Refresh
By default, every scheduled refresh reloads the entire dataset from scratch. For a table with 10 years of sales history, this means reloading 10 years of data every morning even though only yesterday's rows changed. Incremental refresh fixes this — it reloads only the rows that are new or recently modified, keeping the historical data in the model as-is.
// Setting up Incremental Refresh — Power BI Desktop
// Prerequisites:
// - Power BI Premium capacity or Premium Per User licence
// - The source table must have a date/datetime column for partitioning
// - Source must support query folding (SQL Server, Dataverse, etc.)
// Step 1 — Create two parameters in Power Query
// Both must be named EXACTLY (case-sensitive):
// RangeStart (type: Date/Time)
// RangeEnd (type: Date/Time)
// Set current values to any test range: e.g. 2024-01-01 to 2024-02-01
// Step 2 — Filter the date column using these parameters
// In the Orders query, add a filter step:
#"Filtered by date" = Table.SelectRows(
#"Changed Type",
each [OrderDate] >= RangeStart and [OrderDate] < RangeEnd
)
// Power BI will dynamically inject the correct date range
// for each partition during refresh
// Step 3 — Configure Incremental Refresh policy
// Right-click the table in the Fields pane → Incremental refresh
// Archive data starting: 3 years before refresh date (keep history)
// Incrementally refresh data starting: 7 days before refresh date
// Detect data changes (optional): use a LastModified column
// if rows can be updated after insertion
// What happens after the first full refresh:
// Historical data (>7 days old): stored in fixed partitions, never re-queried
// Recent data (last 7 days): re-queried on each refresh
// New day's data: added as a new partition
// Net result: a 10-year table refreshes by querying only the last 7 days
Troubleshooting Refresh Failures
| Error message / symptom | Most likely cause | Fix |
|---|---|---|
| Credentials are required for the data source | Stored credentials expired, password changed, OAuth token revoked | Dataset → Settings → Data source credentials → Edit credentials → re-enter |
| Unable to connect to the data source | Gateway offline, server unreachable, firewall blocking port, SQL Server stopped | Check gateway status in Manage gateways; confirm SQL Server is running; check firewall rules for port 1433 |
| The gateway is offline | The machine running the gateway was restarted or went to sleep; the gateway service stopped | Check the gateway machine: open Windows Services → find "On-premises data gateway service" → Start. Set the service Startup type to Automatic. |
| DataFormat.Error in a specific column | Source data structure changed — a column was renamed, a new column was added with unexpected values, or data types changed | Open Desktop → refresh preview → find the failing step → fix the Power Query transformation → republish |
| Refresh timed out after 2 hours | Dataset too large for the refresh window; a slow data source; no incremental refresh configured | Enable incremental refresh to limit data loaded per refresh. Upgrade to Premium for longer time-out limits. Optimise Power Query queries. |
| Refresh succeeded but data looks wrong | Silent data quality issue in the source; a filter in Power Query excluding valid rows; wrong date range in incremental refresh | Check the source data directly. Review Power Query filters. Check incremental refresh range parameters. Compare row counts before and after refresh. |
Refresh History and Monitoring
// Viewing refresh history — Service
// Workspace → Dataset → "..." menu → Refresh history
// Shows a list of recent refresh attempts:
// Status: Completed / Failed / In Progress / Cancelled
// Start time, End time, Duration
// Error details (click "See details" on failed refreshes)
// Which tables were refreshed and how many rows loaded
// Reading a failure error in the refresh history:
// Click "See details" on a failed refresh row
// The error panel shows:
// Exception type: e.g. "MashupException" (Power Query error)
// "DataSourceError" (connection error)
// "GatewayError" (gateway offline)
// Error message: the full text of the exception
// Time: which step failed and at what time
// Copy the error message for searching documentation
// Refresh history retention:
// Power BI keeps 60 days of refresh history
// For longer audit trails, use Power Automate to log
// refresh status to a SharePoint list or SQL table
// Proactive monitoring with Power Automate:
// Create a flow triggered by "Power BI Dataset refresh completed"
// Condition: if Status = "Failed"
// Action: send Teams message to the operations channel
// with the error details and dataset name
// This provides immediate Slack/Teams notification
// rather than waiting for the email that arrives minutes later
| Date / Time | Status | Duration | Rows loaded |
|---|---|---|---|
| Today 06:00 AM | ✓ Completed | 1m 52s | 14,382 |
| Yesterday 06:00 AM | ✓ Completed | 1m 48s | 14,201 |
| 2 days ago 06:00 AM | ✗ Failed See details | 0m 12s | 0 |
| 3 days ago 06:00 AM | ✓ Completed | 1m 55s | 13,987 |
| 4 days ago 06:00 AM | ✓ Completed | 1m 44s | 13,854 |
Teacher's Note: The most important gateway configuration step that developers consistently skip is setting the Windows gateway service to Automatic startup. By default the service is set to Manual — meaning if the gateway machine restarts (for Windows updates, a power cut, a forced restart), the gateway stays offline until someone manually starts the service. Executives notice within one hour. The fix is a 30-second change: open Windows Services on the gateway machine, find "On-premises data gateway service," right-click → Properties → Startup type → Automatic. Do this immediately after registering the gateway. While you are there, also configure the machine's power settings to never sleep — a gateway that has gone to sleep is functionally the same as one that is offline.
Practice
Practice 1 of 3
Incremental refresh reduces daily refresh time by reloading only the ___ rows from the source rather than the entire table — keeping historical partitions fixed in the model and only re-querying the most recent time window.
Practice 2 of 3
The two Power Query parameters that must be created with exact case-sensitive names before configuring incremental refresh are RangeStart and ___.
Practice 3 of 3
When the gateway machine restarts due to Windows updates and the scheduled refresh begins failing, the fix is to open Windows Services on the gateway machine and change the "On-premises data gateway service" startup type from Manual to ___.
Lesson Quiz
Quiz 1 of 3
You configure incremental refresh on an Orders table: archive 3 years, incrementally refresh the last 30 days. After the first successful full refresh, the source team tells you they occasionally update order records from 90 days ago (e.g. correcting billing errors). Will incremental refresh capture those corrections?
Quiz 2 of 3
A refresh fails with the error "Unable to connect to the data source. Details: The remote name could not be resolved: 'corp-sql-01.internal.company.com'." The gateway is showing as Online in the Service. What is the most likely cause?
Quiz 3 of 3
A dataset's daily refresh is taking 50 minutes to complete and occasionally times out. The source is a SQL Server table with 8 years of transaction history (15 million rows). What is the most impactful single change to reduce refresh time?
Next up — Lesson 50 covers the Power BI Admin Portal, including tenant settings, usage metrics, data export controls, capacity management, and the governance policies that keep a large Power BI deployment secure and compliant.