This walkthrough shows you how to pull your PlantDemand order schedule into a Microsoft Power BI report using the PlantDemand REST API and a personal API key. Once it is set up, your Power BI dashboard refreshes against live PlantDemand data — no exports, no copying and pasting.

What you will need

  • A working PlantDemand login.
  • A PlantDemand API key. If you do not have one yet, follow the create an API token walkthrough first — it takes about five minutes.
  • Microsoft Power BI Desktop installed.
  • The numeric Plant ID for the plant you want to report on. You can find it in the URL bar when you have that plant open in PlantDemand (look for the number after /plant/).

Step 1 — Open Power BI’s Advanced Editor

In Power BI Desktop, go to Home → Get data → Blank query. When the Power Query editor opens, click Home → Advanced Editor. You will be looking at an empty M-language editor.

Step 2 — Paste in the PlantDemand query

Replace the contents of the editor with the M code below.

let
    pYesterday = Date.ToText(Date.From(Date.AddDays(DateTime.LocalNow(), -1)), "YYYY-MM-DD"),
    pPlantDemand_PlantID = "14",

    Source = Json.Document(Web.Contents("https://plantdemand.com/",
                [
                RelativePath="graphql?operationName=null&query=%7B%0A%20%20plantId%3A%20orderDates(plantId%3A%20"
                & pPlantDemand_PlantID &
                "%2C%20dateFrom%3A%20%22"
                & pYesterday &
                "%22)%20%7B%0A%20%20%20%20totalCount%0A%20%20%20%20items%20%7B%0A%20%20%20%20%20%20id%0A%20%20%20%20%20%20quantity%0A%20%20%20%20%20%20nightshift%0A%20%20%20%20%20%20deliveryOn%0A%20%20%20%20%20%20loadTime%0A%20%20%20%20%20%20order%20%7B%0A%20%20%20%20%20%20%20%20id%0A%20%20%20%20%20%20%20%20plant%20%7B%0A%20%20%20%20%20%20%20%20%20%20name%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20customer%20%7B%0A%20%20%20%20%20%20%20%20%20%20name%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20extraFields%0A%20%20%20%20%20%20%20%20material%20%7B%0A%20%20%20%20%20%20%20%20%20%20name%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D",
                Headers=
                        [#"SERVER_API_KEY"="REPLACE_WITH_YOUR_API_KEY", Accept="application/json", Application="JSON"]
                ])),
    #"Converted to Table" = Record.ToTable(Source),
    Value = #"Converted to Table"{0}[Value],
    plantId = Value[plantId],
    items = plantId[items],
    #"Converted to Table1" = Table.FromList(items, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Renamed Columns" = Table.RenameColumns(#"Converted to Table1",{{"Column1", "Orders"}}),
    #"Expanded Orders" = Table.ExpandRecordColumn(#"Renamed Columns", "Orders", {"id", "quantity", "nightshift", "deliveryOn", "loadTime", "order"}, {"Orders.id", "Orders.quantity", "Orders.nightshift", "Orders.deliveryOn", "Orders.loadTime", "Orders.order"}),
    #"Expanded Orders.order" = Table.ExpandRecordColumn(#"Expanded Orders", "Orders.order", {"id", "plant", "customer", "extraFields", "material"}, {"Orders.order.id", "Orders.order.plant", "Orders.order.customer", "Orders.order.extraFields", "Orders.order.material"}),
    #"Expanded Orders.order.plant" = Table.ExpandRecordColumn(#"Expanded Orders.order", "Orders.order.plant", {"name"}, {"Orders.order.plant.name"}),
    #"Expanded Orders.order.material" = Table.ExpandRecordColumn(#"Expanded Orders.order.plant", "Orders.order.material", {"name"}, {"Orders.order.material.name"}),
    #"Expanded Orders.order.customer" = Table.ExpandRecordColumn(#"Expanded Orders.order.material", "Orders.order.customer", {"name"}, {"Orders.order.customer.name"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Expanded Orders.order.customer",{{"Orders.quantity", Int64.Type}, {"Orders.deliveryOn", type date}}),
    #"Renamed Columns1" = Table.RenameColumns(#"Changed Type",{{"Orders.quantity", "PlantDemand Quantity"}, {"Orders.nightshift", "Nightshift"}, {"Orders.deliveryOn", "PlantDemand Order Date"}, {"Orders.order.customer.name", "PlantDemand Customer"}, {"Orders.order.material.name", "PlantDemand Material Name"}})
in
    #"Renamed Columns1"

Step 3 — Update the two values you need to change

  • pPlantDemand_PlantID = "14" — replace 14 with the numeric plant ID for your own plant.
  • SERVER_API_KEY = "REPLACE_WITH_YOUR_API_KEY" — paste in the API key value you copied from the API token walkthrough.

Click Done. Power BI will run the query and pull yesterday’s order data from PlantDemand. The query is configured to look one day back (Date.AddDays(... , -1)) — adjust that offset, or change to dateFrom / dateTo ranges, to fit your reporting window.

Step 4 — Use the data in your report

The query returns a table with columns for the customer, material, plant, order date, quantity, night-shift flag, and load time. Drag those into Power BI visuals exactly as you would with any other data source. Schedule a Power BI service refresh if you want the report to stay current automatically.

Security and rotation

The API key in this query authenticates to PlantDemand as the user who created it, scoped to whatever permissions you gave the key. Two reminders:

  • Use a least-privilege key. A read-only Power BI report only needs view_orders, view_order_plan, view_customers, and view_plant_configuration. Drop the edit_* permissions when you create the key.
  • Set an expiration date and rotate. When you create the key, set "expiration_date": "YYYY-MM-DD" and roll the report over to a new key before the old one expires.

For more on key handling, see the API token walkthrough and the MCP security overview.

Want AI on top of this data?

The Power BI integration is the classic dashboard path. If you want to ask questions of your PlantDemand schedule in plain English — “what is on the plan for next Tuesday?”, “which customers ordered the most 12.5mm mix last month?” — connect the PlantDemand MCP server to Claude, ChatGPT, Copilot Studio, or any other MCP-compatible AI assistant. It uses the same API key.

Frequently Asked Questions

What data does the Power BI query pull from PlantDemand?

The example query pulls yesterday’s order schedule for one plant — order id, quantity, night-shift flag, delivery date, load time, customer, material, and plant name. You can adjust the date window and the GraphQL fields to fit your report.

Do I need a separate API key for Power BI?

You do not have to, but it is strongly recommended. A dedicated read-only key for Power BI lets you scope permissions tightly and rotate or revoke it without affecting your other integrations.

How often does the report refresh?

On demand whenever you press Refresh in Power BI Desktop, and on whatever schedule you configure in the Power BI service. The PlantDemand REST API itself is live, so each refresh sees current data.

This guide is part of the the PlantDemand scheduling platform hub for asphalt plant operations, scheduling, and sales management.