Appearance
Power BI
This guide builds the three tiles from the Recipes in Power BI Desktop, then publishes the report and schedules its refresh in the Power BI service. The tiles are due and overdue checks, completed against scheduled, and open actions.
Power BI calls the API with its Web connector and an Authorization header. You'll write the queries in the Advanced Editor, because the header and the query parameters need to be kept separate from the base URL for scheduled refresh to work.
You need Power BI Desktop and an API key with hierarchy:read, checks:read and actions:read. See Getting Started. Give the report its own API client, scoped to the factories it shows. See Security.
1. Create Parameters
In Power BI Desktop, select Home → Transform data to open Power Query. Then select Home → Manage Parameters → New Parameter and create three parameters:
| Name | Type | Current value |
|---|---|---|
ContinualBaseUrl | Text | https://api.continualapp.com/public/v1 |
ContinualApiKey | Text | Your key, cntl_live_… |
ContinualUtcOffsetHours | Decimal Number | Your factory's UTC offset, for example 10 for Melbourne in winter, or 1 for London in summer |
The offset decides where "today" and the 30-day window start. The API still buckets each day in the factory's real time zone, including daylight saving. Update the offset when the clocks change if exact day boundaries matter.
Anyone who can edit the report can read the key
Power BI stores parameter values in the report. Keep the .pbix file and the workspace restricted, and use a client with only the permissions and factories this report needs.
2. Add the Helper Queries
For each query below, select Home → New Source → Blank Query, open Advanced Editor, paste the code, then rename the query to the name given.
ContinualGet calls one API path and returns the parsed JSON:
powerquery
(path as text, query as record) =>
let
Response = Web.Contents(
ContinualBaseUrl,
[
RelativePath = path,
Query = query,
Headers = [Authorization = "Bearer " & ContinualApiKey]
]
)
in
Json.Document(Response)ContinualSummary runs a summary and returns its groups as a table with the columns you name:
powerquery
(path as text, query as record, columns as list) =>
let
Groups = ContinualGet(path, query)[groups],
Rows = Table.FromList(Groups, Splitter.SplitByNothing(), {"group"}),
Expanded = Table.ExpandRecordColumn(Rows, "group", columns)
in
ExpandedContinualLocalMidnight is today's local midnight, as a time-zone-aware value:
powerquery
let
LocalNow = DateTimeZone.SwitchZone(DateTimeZone.UtcNow(), ContinualUtcOffsetHours),
Midnight = #datetimezone(
Date.Year(LocalNow), Date.Month(LocalNow), Date.Day(LocalNow), 0, 0, 0,
ContinualUtcOffsetHours, 0
)
in
MidnightContinualTimestamp formats a time the way the API expects, with its offset:
powerquery
(value as datetimezone) as text =>
DateTimeZone.ToText(value, [Format = "yyyy-MM-dd'T'HH:mm:sszzz", Culture = "en-US"])Keep ContinualBaseUrl as the first argument to Web.Contents, with the path in RelativePath and the filters in Query. If you join them into one URL string, the Power BI service treats the URL as dynamic and refuses to refresh it.
3. Add the Lines Table
Summaries return line IDs. Create Lines to label them. It follows next_cursor, so it works however many lines you have, and it includes archived lines so history keeps its labels:
powerquery
let
GetPage = (cursor as nullable text) =>
ContinualGet(
"lines",
[limit = "500", include_archived = "true"]
& (if cursor = null then [] else [cursor = cursor])
),
Pages = List.Generate(
() => GetPage(null),
each _ <> null,
each if _[next_cursor] = null then null else GetPage(_[next_cursor])
),
Records = List.Combine(List.Transform(Pages, each _[data])),
Rows = Table.FromList(Records, Splitter.SplitByNothing(), {"line"}),
Lines = Table.ExpandRecordColumn(Rows, "line", {"id", "factory_id", "name", "line_type", "status"}),
Typed = Table.TransformColumnTypes(Lines, {{"name", type text}})
in
Typed4. Add the Tile Queries
DueNow is the due now recipe, per line:
powerquery
let
Source = ContinualSummary(
"check-instances/summary",
[status = "due", group_by = "line_id"],
{"line_id", "count"}
),
Typed = Table.TransformColumnTypes(Source, {{"count", Int64.Type}})
in
TypedOverdueNow is the overdue now recipe, per line:
powerquery
let
Source = ContinualSummary(
"check-instances/summary",
[status = "overdue", group_by = "line_id"],
{"line_id", "count"}
),
Typed = Table.TransformColumnTypes(Source, {{"count", Int64.Type}})
in
TypedMissedToday is the missed recipe, from local midnight until now. It counts checks that have closed without a result; overdue checks are in OverdueNow:
powerquery
let
Source = ContinualSummary(
"check-instances/summary",
[
status = "missed",
origin = "scheduled",
check_kind = "cil,centreline",
include_archived = "false",
due_from = ContinualTimestamp(ContinualLocalMidnight),
group_by = "line_id"
],
{"line_id", "count"}
),
Typed = Table.TransformColumnTypes(Source, {{"count", Int64.Type}})
in
TypedCompletionByDay is the completed against scheduled recipe, the portal's headline completion rate, for the last 30 local days:
powerquery
let
Source = ContinualSummary(
"check-instances/summary",
[
origin = "scheduled",
check_kind = "cil,centreline",
include_archived = "false",
due_from = ContinualTimestamp(ContinualLocalMidnight - #duration(30, 0, 0, 0)),
group_by = "due_date"
],
{"due_date", "count", "completion_rate"}
),
Typed = Table.TransformColumnTypes(
Source,
{{"due_date", type date}, {"count", Int64.Type}, {"completion_rate", type number}}
)
in
TypedOpenActions is the open actions recipe, per line and category:
powerquery
let
Source = ContinualSummary(
"actions/summary",
[status = "open,pending_verification", group_by = "line_id,category"],
{"line_id", "category", "count"}
),
Labelled = Table.ReplaceValue(Source, null, "manual", Replacer.ReplaceValue, {"category"}),
Typed = Table.TransformColumnTypes(Labelled, {{"category", type text}, {"count", Int64.Type}})
in
TypedThe first time a query runs, Power BI asks how to connect to https://api.continualapp.com/public/v1. Choose Anonymous and select Connect. The key travels in the header you wrote, and Power BI only allows a custom Authorization header with anonymous access. If it asks about privacy levels, choose Organizational.
Select Close & Apply.
5. Relate and Build the Tiles
In Model view, drag Lines[id] onto line_id in each of DueNow, OverdueNow, MissedToday and OpenActions to create one-to-many relationships.
Then, in Report view:
| Tile | Visual | Fields |
|---|---|---|
| Due and overdue checks | Clustered bar chart | Y-axis: Lines[name]. X-axis: DueNow[count], OverdueNow[count] and MissedToday[count]. Rename them "Due now", "Overdue now" and "Missed today". |
| Completed against scheduled | Line chart | X-axis: CompletionByDay[due_date] (set it to Continuous, not a date hierarchy). Y-axis: CompletionByDay[completion_rate], summarised as Average. |
| Open actions | Matrix | Rows: Lines[name]. Columns: OpenActions[category]. Values: OpenActions[count]. |
For headline cards, add Card visuals with the sum of DueNow[count], OverdueNow[count] and OpenActions[count].
Each completion_rate is already a daily percentage, so don't sum it. Average is correct for one row per day. For one rate over the whole period, add a query like CompletionByDay without group_by, rather than averaging the daily rates.
6. Publish and Schedule Refresh
- Select Home → Publish and choose a workspace.
- In the Power BI service, open the workspace, find the semantic model, and open Settings.
- Under Data source credentials, select Edit credentials for
https://api.continualapp.com/public/v1. Set Authentication method to Anonymous and Privacy level to Organizational, tick Skip test connection, and sign in. The test call has no key, so it would fail with401if you didn't skip it. - Under Refresh, turn on Configure a refresh schedule and pick your times.
No gateway is needed: the API is on the public internet.
Each refresh makes five requests: one each for the four tiles, and one or more for Lines. That is well within the rate limits, even with several reports.
Troubleshooting
| Symptom | Cause |
|---|---|
Access to the resource is forbidden or (401) | The key is wrong, expired or revoked, or the credentials aren't set to Anonymous. Call /me with the key to check it. |
(403) | The key's client lacks a permission. Lines needs hierarchy:read, the check tiles need checks:read and OpenActions needs actions:read. |
(422) | A filter is invalid. Run the same request with curl to see invalid_params. |
| "This dataset includes a dynamic data source" | A query builds its URL from text. Keep the base URL as the first argument to Web.Contents, as in ContinualGet. |
A refresh fails with (429) | Too many refreshes at once for one client. Stagger the schedules, or give each report its own client. |
| Lines show as blank | The line is in the summary but not in Lines. Check Lines includes include_archived = "true" and that the client has hierarchy:read. |