Oil prices in Power BI with Power Query
Bring Brent prices into an internal Power BI report with Power Query. Refresh a benchmark alongside purchasing costs and retain the source timestamp.
Compare a Brent benchmark with purchase costs
- In Power BI Desktop, create a private text parameter named OilPriceApiKey and set it to your account key. Only share the model with people authorized to use that credential.
- Open a blank query in the Advanced Editor and paste the query below. Select Anonymous for the web data source because the query supplies the authorization header.
- Set price to a decimal and as_of to a datetime with time zone. Keep the benchmark unit beside your purchasing measure and choose a refresh schedule within your plan allowance.
Power Query M
let
Raw = Json.Document(Web.Contents("https://api.oilpriceapi.com", [
RelativePath = "v1/prices/latest",
Query = [by_code = "BRENT_CRUDE_USD"],
Headers = [Authorization = "Token " & OilPriceApiKey]
])),
Quote = Raw[data]
in
Table.FromRecords({Record.SelectFields(Quote,
{"code", "price", "currency", "unit", "as_of"})})Latest BRENT_CRUDE_USD from the API
$90.54per barrel
As of 2026-11-23 13:31 UTC