Text.NewGuid

Text

Returns a new randomly generated GUID as a text string.

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

Syntax

Text.NewGuid() as text

Return Value

textA new GUID in standard lowercase format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.

Remarks

Text.NewGuid generates a new version-4 (randomly generated) GUID each time it is called, returning it as a lowercase text string in the standard xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format. It takes no parameters.

Text.NewGuid is a volatile (non-deterministic) function — its result changes on every evaluation. This has an important consequence in Power Query: because the engine may evaluate expressions multiple times during a query refresh (for example, when computing row counts, previewing data, or applying filters), each evaluation will produce a different GUID. You should not rely on Text.NewGuid to produce stable, consistent unique identifiers per row across refreshes.

If you need row-level GUIDs that persist across refreshes, generate them outside Power Query (in a database column, or as a static dataset) and load them as source data. For situations where only uniqueness within a single refresh is needed — such as generating a correlation ID for an API request — Text.NewGuid is appropriate.

To validate or normalize an existing GUID string (e.g., from an external system), use Guid.From instead.

Examples

Example 1: Generate a single GUID value

Result
Result
1a3f8c2d1-4b7e-4f2a-9c6d-1e8b3a5f0d72

Example 2: Add a GUID column to a table

Table.AddColumn(
    #table({"CustomerName"}, {{"Alice"}, {"Bob"}, {"Charlie"}}),
    "SessionID",
    each Text.NewGuid()
)
Result
CustomerName
SessionID
1Alicec1a2b3d4-e5f6-7890-abcd-ef1234567890
2Bobd4e5f6a7-b8c9-0123-4567-89abcdef0123
3Charliee5f6a7b8-c9d0-1234-5678-9abcdef01234

Example 3: Verify the output is valid GUID format

Guid.From(Text.NewGuid())
Result
Result
1f0e1d2c3-b4a5-6789-0abc-def012345678

Compatibility

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