- Use Our Data
- Integrations
- Power BI
Power Outage Data in Power BI
To get power outage data into Power BI, add a Power Query that calls the PowerOutage.us v2 REST API with Web.Contents, sends your key in an Authorization header from a parameter, and reads county counts as CSV. Once the report is published, the Power BI service refreshes it on a schedule without a gateway, provided the data source is set to Anonymous and its connection test is skipped. This guide covers the parameter, the query, three DAX measures, and the service settings that make refresh work.
What you'll have
- A county table with customers out, customers tracked, FIPS codes and last update time for the states you choose.
- Measures for customers out, percent of customers out, and minutes since each county was last reported.
- FIPS codes kept as text with their leading zeros, ready to relate to census or customer tables.
- Scheduled refresh in the Power BI service with no on-premises data gateway: up to 8 times a day on Pro, or 48 on Premium Per User, Premium and Fabric capacity.
What you need
An API key (request one with the form below) and these endpoints. Full details are in the API reference.
| Endpoint | Method | Used for | Package |
|---|---|---|---|
/outages/counties | GET | County customersOut, customersTracked and lastUpdatedAt as CSV with format=csv, plus FIPS codes with include=fips. | Core |
Step 1: Put the key in a parameter
Power BI Desktop has no secret store, so the key goes in a query parameter. In Power Query Editor choose Manage Parameters, then New Parameter. Name it PowerOutageApiKey, set Type to Text, and paste your key as the Current Value. The key is saved inside the .pbix file and published with the semantic model, where anyone who can change the model's settings can read it under Parameters. Don't share the file, and use a separate key restricted to the areas this report needs.
Step 2: Add the county query
Choose New Source, then Blank Query, open Advanced Editor, paste this query, and rename it Counties. The URL stays a fixed string and the filters go in the Query option, which keeps the source refreshable in the Power BI service. When Power BI Desktop asks how to connect, choose Anonymous: Power Query sends a custom Authorization header only on anonymous connections, and that header carries your key. The FIPS columns stay text so their leading zeros survive. If the API answers 429, Web.Contents retries by itself, waiting the Retry-After seconds, up to three times.
let
// 44 is Florida and 45 is Georgia. List ids with GET /outages/states.
Source = Web.Contents(
"https://poweroutage.us/api/v2/outages/counties",
[
Query = [stateId = "44,45", format = "csv", include = "fips"],
Headers = [Authorization = "Bearer " & PowerOutageApiKey]
]
),
Csv = Csv.Document(Source, [Delimiter = ",", Encoding = 65001, QuoteStyle = QuoteStyle.Csv]),
Promoted = Table.PromoteHeaders(Csv, [PromoteAllScalars = true]),
Typed = Table.TransformColumnTypes(
Promoted,
{
{"id", Int64.Type},
{"name", type text},
{"stateId", Int64.Type},
{"countryCode", type text},
{"customersTracked", Int64.Type},
{"customersOut", Int64.Type},
{"lastUpdatedAt", type datetimezone},
{"fips.state", type text},
{"fips.county", type text},
{"fips.full", type text}
}
),
// The CSV has no meta.generatedAt, so stamp each refresh to measure staleness against
Stamped = Table.AddColumn(Typed, "refreshedAt", each DateTimeZone.FixedUtcNow(), type datetimezone)
in
Stamped Step 3: Add measures and build the report
Select Close & Apply, then add these measures to the Counties table. Percent out is customers out divided by customers tracked. Minutes since report compares each county's lastUpdatedAt with the refresh time; records are not zeroed when a utility stops reporting, so a large value means the count may be out of date. Relate and group counties by id or fips.full, never by name, because county names repeat across states. Each state can include a county named Unknown with blank FIPS columns, holding customers a utility could not place in a county.
Customers Out = SUM ( Counties[customersOut] )
Percent Out =
DIVIDE ( SUM ( Counties[customersOut] ), SUM ( Counties[customersTracked] ) )
Minutes Since Report =
DATEDIFF ( MAX ( Counties[lastUpdatedAt] ), MAX ( Counties[refreshedAt] ), MINUTE ) Step 4: Publish and set the data source to Anonymous
Publish to a workspace, open the semantic model's settings, and expand Data source credentials. Choose Edit credentials, set Authentication method to Anonymous and Privacy level to Organizational, check Skip test connection, and sign in. The service tests a connection without the options from your query, so the test reaches the API without your key, gets 401, and would stop the credentials from saving; scheduled refresh runs the full query with the header. No gateway is needed, because Power BI reaches poweroutage.us directly over the internet.
Step 5: Schedule the refresh
On the semantic model, choose Refresh, then Schedule refresh, set Configure a refresh schedule to On, and add time slots. Semantic models in Pro workspaces get up to 8 scheduled refreshes a day; Premium Per User, Premium and Fabric capacity allow 48, one every 30 minutes, the most often Power BI refreshes a model on a schedule, while the data itself updates every minute. A refresh starts within about 15 minutes of its slot, and the service turns the schedule off after four consecutive failures, for example when the key is revoked.
Tips for Power BI
- Keep the URL in
Web.Contentsa literal string and change filters throughQuery. A URL built from other queries or columns is a dynamic data source, which the Power BI service cannot refresh; Data source settings in Power Query Editor shows a warning when a query has one. - Avoid the Web API credential type. It puts the key in the query string, the Power BI service does not support it, and the v2 API reads the key only from the
Authorizationheader. - If you chose another credential type by mistake, Desktop refuses the header. Open File, Options and settings, Data source settings, select the
poweroutage.usentry, and change it to Anonymous under Edit Permissions. - Scheduled refresh pauses after two months in which nobody opens a report built on the model. Opening any of those reports resumes it.
- Each refresh makes one request, so several reports on the same key stay well under the limit of 10 requests per 10 seconds.
Used by
Related integrations
FAQ
Here are some commonly asked questions
Request API access
Tell us what you're building and we'll set you up with a trial key.