Uri.Combine

Uri

Combines a base URI and a relative URI into a single resolved URI, following standard URI resolution rules.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

Uri.Combine(baseUri as text, relativeUri as text) as text

Parameters

NameTypeRequiredDescription
baseUritextYesThe base URI to resolve against.
relativeUritextYesThe relative URI to resolve. May be an absolute path, relative path, or full URI.

Return Value

textA fully resolved URI text value.

Remarks

Uri.Combine follows standard RFC 3986 URI resolution rules to combine a base URI with a relative reference. This is the correct way to construct URLs in Power Query rather than using & or Text.Combine, because it properly handles path traversal, trailing slashes, and absolute path references.

The most important behavioral detail is the trailing slash rule: - "https://api.example.com/v1/" + "users" produces "https://api.example.com/v1/users" (slash present — resolves relative to /v1/ directory) - "https://api.example.com/v1" + "users" produces "https://api.example.com/users" (no slash — resolves relative to / since v1 is treated as a file, not a directory)

Always ensure your base URI ends with a trailing slash when you intend to append path segments to it. This is the most common source of bugs when building paginated API calls.

Other key behaviors: - If relativeUri starts with a scheme (e.g., https://), it is returned as-is, ignoring the base - If relativeUri starts with /, it replaces the entire path on the base host - If relativeUri is a relative path (no leading /), it resolves relative to the directory portion of the base path

Prefer Uri.Combine over string concatenation even for simple cases — it documents intent clearly and prevents subtle URL construction errors that can be hard to diagnose.

Examples

Example 1: Append a path segment to a base URL with trailing slash

Uri.Combine("https://api.example.com/v1/", "users")
Result
Result
1https://api.example.com/v1/users

Example 2: No trailing slash — relative segment resolves to the parent directory

Uri.Combine("https://api.example.com/v1/users", "orders")
Result
Result
1https://api.example.com/v1/orders

Example 3: Absolute path in the relative URI replaces the base path

Uri.Combine("https://api.example.com/v1/users", "/v2/orders")
Result
Result
1https://api.example.com/v2/orders

Example 4: Build a paginated API URL dynamically

let
    baseUrl = "https://api.example.com/data/",
    page = 2,
    url = Uri.Combine(baseUrl, "records?page=" & Number.ToText(page))
in
    url
Applied Steps

The final output — the fully resolved paginated API URL for page 2.

Result
1https://api.example.com/data/records?page=2

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks