Uri.Parts

URI

Parses an absolute URI into a record of its component parts.

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

Syntax

Uri.Parts(absoluteUri as text) as record

Parameters

NameTypeRequiredDescription
absoluteUritextYesThe absolute URI to parse.

Return Value

recordA record containing the URI components: Scheme, Host, Port, Path, Query, Fragment, and more.

Remarks

Uri.Parts breaks an absolute URI into its components and returns them as a record with the following fields:

FieldTypeDescription
SchemetextThe protocol (e.g., "https").
HosttextThe hostname (e.g., "www.example.com").
PortnumberThe port number (e.g., 443).
PathtextThe path segment (e.g., "/api/data").
QueryrecordQuery string parameters as a record (e.g., [page = "1"]).
FragmenttextThe fragment identifier after #.

This function is useful for extracting specific parts of URLs stored in your data — for example, pulling the domain from a list of web addresses, or extracting query-string parameters.

Examples

Example 1: Parse a URL into components

let
    Url = "https://api.example.com:8080/data/items?category=electronics&page=2",
    Parts = Uri.Parts(Url)
in
    #table(
        {"Component", "Value"},
        {
            {"Scheme", Parts[Scheme]},
            {"Host", Parts[Host]},
            {"Port", Text.From(Parts[Port])},
            {"Path", Parts[Path]}
        }
    )
Applied Steps

The final output — a table showing four selected URI components (Scheme, Host, Port, Path) extracted from the parsed record.

Component
Value
1Schemehttps
2Hostapi.example.com
3Port8080
4Path/data/items

Example 2: Extract domain from URLs in a table

let
    Source = #table({"Page"}, {{"https://shop.example.com/products/123"}, {"https://blog.example.com/posts/hello"}}),
    Added = Table.AddColumn(Source, "Domain", each Uri.Parts([Page])[Host], type text)
in
    Added
Applied Steps

The final output — the table with the original Page URLs and their extracted Domain host names.

Page
Domain
1https://shop.example.com/products/123shop.example.com
2https://blog.example.com/posts/helloblog.example.com

Compatibility

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