Text.NewGuid

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"

With a GUID like the one above, there are 340 undecillion, 282 decillion, 366 nonillion, 920 octillion, 938 septillion, 463 sextillion, 463 quintillion, 374 quadrillion, 607 trillion, 431 billion, 768 million, 211 thousand and 456 possible unique UUIDs.

This is an astronomically large number, ensuring that, when generated correctly, each UUID will be unique for all practical purposes.

Other functions related to Text.NewGuid are:

BI Gorilla Youtube Channel

Last update: August 17, 2023 | Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/text-newguid
© 2023 BI Gorilla. All rights reserved. Content derived from Microsoft documentation is property of Microsoft Corp.