Text.NewGuid

Updated on

Text.NewGuid is a Power Query M function that generates a new, random globally unique identifier (GUID). The function returns a new GUID as a text value.

Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365

Syntax

Text.NewGuid() as text

Description

The Text.NewGuid function requires no input and serves a single purpose: it generates a new, random GUID each time it is called. Notably, each refresh of your dataset triggers a regeneration of these unique identifiers, maintaining the uniqueness of your data rows across refreshes.

Why would you want to create a GUID? In short, GUIDs guarantee a unique identifier across your dataset. They are randomly generated, and their length and complexity make it nearly impossible to have two identical GUIDs. This uniqueness is especially beneficial in databases or any data structure where unique identification is crucial. You can use GUIDs as primary keys in your tables, or to trace data through complex systems or across platforms.

Examples

Now, let’s see the Text.NewGuid function in action. Consider a scenario where you need to assign a unique identifier to each row in your table. For every row, Text.NewGuid generates a unique GUID. Remember, each refresh of your dataset results in new unique GUIDs for each row.

Text.NewGuid() // Possible output: "48d19fef-e08b-41c3-8964-2432bbb3e260"

Other functions related to Text.NewGuid are:

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/text-newguid