Build Power BI reports with NowMetrix data
Import NowMetrix metrics with Power Query, create a first report in Power BI Desktop, and publish the dataset for controlled sharing and scheduled updates.
How the connection works
The connection has two optional stages:
NowMetrix REST API → Power Query → Power BI Desktop → optional Power BI Service
- Power BI Desktop creates the query, data model, and report.
- Power BI Service publishes the report for browser access, sharing, and scheduled refresh.
The prepared example imports the last 30 available daily rows from /v1/overview.
Every row includes the date, tracker, tracker timezone, pageviews, and visits.
Before you start
You need:
- a NowMetrix account with REST API access,
- access to the tracker you want to report on,
- Microsoft Power BI Desktop for creating the report, and
- an appropriate Power BI account and workspace if you want to publish or schedule refreshes.
Power BI licensing, workspace permissions, and available refresh frequencies are managed by Microsoft and your organization's administrator. You can complete the Desktop setup without publishing the report.
1. Create a dedicated API key
- Sign in to NowMetrix.
- Open Settings → API.
- Create a new key labeled Microsoft Power BI.
- Copy the complete key immediately. It is shown only once.
- Note the tracker ID for the website you want to import.
| Placeholder | Replace with | Example |
|---|---|---|
nm_YOUR_KEY |
Your complete NowMetrix API key | nm_… |
TRACKER_ID |
The tracker ID to import | news-example-com |
2. Create a blank query in Power BI Desktop
- Open Power BI Desktop and create a blank report.
- Select Home → Get data → Blank query. If it is not listed, select Get data → More and search for Blank query.
- Power Query Editor opens with a new query.
- Select Home → Advanced Editor.
Do not choose the basic Web dialog for this example. The Advanced Editor is used because NowMetrix requires a Bearer authorization header and the response must be converted from JSON into table rows.
3. Paste the prepared Power Query
- Remove the existing content from the Advanced Editor.
- Paste the complete query below.
- Replace
nm_YOUR_KEYandTRACKER_IDin the first two lines. - Keep both values inside quotation marks.
- Select Done.
let
ApiKey = "nm_YOUR_KEY",
TrackerId = "TRACKER_ID",
Response = Json.Document(
Web.Contents(
"https://api.nowmetrix.com",
[
RelativePath = "v1/overview",
Query = [
site = TrackerId,
days = "30"
],
Headers = [
Authorization = "Bearer " & ApiKey,
Accept = "application/json"
],
Timeout = #duration(0, 0, 0, 30)
]
)
),
DailyRows = if List.IsEmpty(Response[daily]) then
#table(type table [date = text, pageviews = Int64.Type, visits = Int64.Type], {})
else
Table.FromRecords(Response[daily]),
AddTracker = Table.AddColumn(
DailyRows,
"tracker",
each Response[site],
type text
),
AddTimezone = Table.AddColumn(
AddTracker,
"timezone",
each Response[timezone],
type text
),
ReorderedColumns = Table.ReorderColumns(
AddTimezone,
{"date", "tracker", "timezone", "pageviews", "visits"}
),
TypedColumns = Table.TransformColumnTypes(
ReorderedColumns,
{
{"date", type date},
{"tracker", type text},
{"timezone", type text},
{"pageviews", Int64.Type},
{"visits", Int64.Type}
}
)
in
TypedColumns
The query uses a fixed base URL together with RelativePath and Query.
This keeps the source predictable for later refreshes and sends the API key only in the HTTPS
Authorization header.
4. Confirm the data source credentials
Power BI may ask how it should connect to https://api.nowmetrix.com.
- Choose Anonymous.
- Apply the setting to
https://api.nowmetrix.com. - Select Connect.
- If prompted for a privacy level, select the level required by your organization. Private provides the strictest separation from other data sources.
5. Load and verify the semantic model
- Wait until the query preview shows
date,tracker,timezone,pageviews, andvisits. - Rename the query to NowMetrix Daily.
- Select Home → Close & Apply.
- Open the Data view and confirm that rows and column types are correct.
| Column | Recommended Power BI type |
|---|---|
date | Date |
tracker | Text |
timezone | Text |
pageviews | Whole number |
visits | Whole number |
6. Build a first report
A simple report confirms that the imported fields behave correctly:
- Return to the Report view.
- Add a Line chart.
- Place
dateon the X-axis. - Place
pageviewsandvisitson the Y-axis. - Add two Card visuals for the sums of
pageviewsandvisits. - Optionally add
trackeras a slicer when the model later contains multiple trackers.
Select Home → Refresh to test the complete Desktop refresh. Existing visuals update when the query finishes.
7. Publish to Power BI Service
- Save the PBIX file in a protected location.
- In Power BI Desktop, select Home → Publish.
- Sign in with your organization's Power BI account.
- Select the intended workspace.
- Open the published report from the confirmation dialog.
Publishing creates a report and an associated semantic model. Scheduled refresh is configured on the semantic model, not on an individual chart or report page.
8. Configure scheduled refresh
- Open the workspace in Power BI Service.
- Find the semantic model created by the published PBIX file.
- Open Settings or select Refresh → Schedule refresh.
- Under Data source credentials, edit the credentials for
https://api.nowmetrix.com. - Select Anonymous as the authentication method and the privacy level required by your organization.
- Enable the refresh schedule and select an appropriate frequency and time zone.
- Enable refresh failure notifications for the semantic model owner or another responsible person.
- Save the settings, select Refresh now, and inspect Refresh history.
api.nowmetrix.com. The query deliberately uses
RelativePath and Query, which are supported exceptions for refreshable
web queries with variable query parameters.
Available refresh frequencies depend on the Power BI license and workspace capacity. Microsoft documents the current controls, limits, failure behavior, and refresh history in its scheduled refresh guide.
Optional: make the key and tracker configurable
Power Query parameters make it easier to change the tracker or rotate the key without editing the entire query. They improve maintainability, but they are not a secret store.
- In Power Query Editor, select Home → Manage Parameters → New Parameter.
- Create a required Text parameter named
pNowMetrixApiKeyand enter the API key as its current value. - Create another required Text parameter named
pNowMetrixTrackerIdand enter the tracker ID. - Replace the first two query lines with the lines below.
ApiKey = pNowMetrixApiKey,
TrackerId = pNowMetrixTrackerId,
After publishing, editable parameters may appear in the semantic model settings. Workspace access must still be restricted because users with sufficient permissions can inspect or change them.
Add other NowMetrix datasets
Create a separate Power Query for each dataset and use relationships in the model when appropriate:
| Use case | Endpoint | Modeling note |
|---|---|---|
| Daily Pageviews and Visits | /v1/overview |
One row per tracker and date |
| Completed-period top pages | /v1/recap |
Store the requested range with each imported result |
| Current live articles | /v1/realtime |
A refresh replaces the snapshot unless you build separate history storage |
| Current sources | /v1/sources |
Use the response timestamp when combining snapshots |
| Proofreading issues | /v1/proofreading |
Restrict report access to the relevant editorial team |
RelativePath will not transform the new response correctly. Adapt the steps after
Response using the endpoint's documented response example.
Security and sharing checklist
- Use a dedicated NowMetrix API key for each Power BI semantic model.
- Grant the NowMetrix user only the tracker access required by the report.
- Store the PBIX file in a protected location and never publish it as a public download.
- Treat PBIX editors and semantic model owners as trusted users who may inspect the query.
- Do not place the key in visuals, report filters, URLs, screenshots, or documentation.
- Use the smallest Power BI workspace audience that meets the reporting requirement.
- Review report, workspace, app, build, reshare, and download permissions before distribution.
- Revoke the key immediately if the PBIX file, workspace, or owner account may be compromised.
- When ownership changes, confirm that refresh credentials and failure notifications still work.
Troubleshooting
| Problem | What to check |
|---|---|
| Power BI keeps asking for credentials | In File → Options and settings → Data source settings, clear permissions for https://api.nowmetrix.com, reconnect, and choose Anonymous. |
401 or “access to the resource is forbidden” |
Check that the complete key replaced nm_YOUR_KEY, contains no spaces, and has not been revoked. |
403 |
The key cannot access the configured tracker. Verify TRACKER_ID and the NowMetrix user's tracker permissions. |
429 |
The tracker-wide API limit was exceeded. Wait and reduce scheduled or manual refresh frequency. |
503 |
The analytics backend is temporarily unavailable. Keep the existing semantic model and retry later. |
| Desktop refresh works, Service refresh fails | Check the semantic model's data source credentials, owner, privacy level, refresh history, and whether your administrator blocks cloud web sources or hand-authored queries. |
| Power BI reports a dynamic data source | Confirm that the query still uses the fixed https://api.nowmetrix.com base URL with RelativePath and Query. Do not build the complete URL by concatenating text. |
| The scheduled refresh is disabled | Open refresh history, resolve the latest failure, verify credentials, and enable the schedule again. Power BI can pause schedules after repeated failures or inactivity. |
| Gateway configuration appears unexpectedly | Confirm that Power BI classifies the source as a reachable cloud Web source. Ask the workspace administrator to review gateway and cloud connection settings. |