Power BI

Modified on Wed, 15 Jul at 4:14 PM

This guide shows how to bring ILAP Analytics scheduling data into Power BI using Power Query. It covers two patterns — GraphQL queries shaped to return only the fields a report needs, and a paginated REST export for bulk data (the same paging pattern used in the Fabric guide) — and is for planners and Power BI / report developers. It assumes basic familiarity with the Power Query Editor, and that you can obtain a DataReader bearer token — see the Authentication guide for how to get one.

Authentication in Power Query

Store the token as a Power Query parameter (for example DataReaderToken) rather than hardcoding it in a query, so it can be updated without editing every query that uses it. See the Authentication guide for how to obtain a DataReader token.

Option 1 — GraphQL (shaped queries)

Use GraphQL when a visual only needs a handful of fields — the query shapes the response so Power Query doesn't have to expand and discard unused columns.

let
  BaseUrl = "https://app-ilapanalytics-api-dev.azurewebsites.net",
  Token = "<DataReader bearer token>",
  Query = "{ reportSchedules { reportScheduleTypeId description status isClosed lastSubmitted } }",
  Body = Json.FromValue([ query = Query ]),
  Resp = Web.Contents(BaseUrl & "/graphql", [
    Headers = [ #"Content-Type" = "application/json", Authorization = "bearer " & Token ],
    Content = Body ]),
  Json = Json.Document(Resp),
  Rows = Json[data][reportSchedules],
  Table = Table.FromRecords(Rows)
in
  Table

Option 2 — REST export (bulk, paginated)

Use the REST export endpoints when you need a full bulk dataset rather than a shaped subset — for example, all activities for a report schedule. This is the same paging pattern used in the Fabric guide's Dataflow Gen2 pattern.

let
  BaseUrl = "https://app-ilapanalytics-api-dev.azurewebsites.net",
  Token = "<DataReader bearer token>",
  ReportScheduleId = "<report schedule id>",
  PageSize = 1000,
  // Each response is an OffsetPaginationResult record: [Data], [PageNumber], [PageSize], [TotalItems], [TotalPages]
  GetPage = (page as number) as record =>
    Json.Document(Web.Contents(BaseUrl & "/api/v3/export/Activities", [
      Query = [ ReportScheduleId = ReportScheduleId, RevisionType = "Live",
                PageNumber = Text.From(page), PageSize = Text.From(PageSize) ],
      Headers = [ Authorization = "bearer " & Token ] ])),
  FirstPage = GetPage(1),
  TotalPages = FirstPage[TotalPages],
  AllRows = List.Combine(
      { FirstPage[Data] } & List.Transform({2..TotalPages}, each GetPage(_)[Data]) ),
  Table = Table.FromRecords(AllRows)
in
  Table

Refresh & scheduling

If this report is published to the Power BI Service and refreshed on a schedule, the DataReader token parameter needs to stay valid for the life of the schedule, and any on-premises data gateway configuration must allow outbound calls to the API's base URL; consider a token with a long enough lifetime (or a refresh process) so scheduled refreshes don't start failing silently.

See also

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article