Guid.From

Updated on

Guid.From is a Power Query M function that converts a given value into a Guid.Type value, if the value is in an acceptable format. The function returns the Guid.Type value or null if the input is null.

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

Syntax

Guid.From( value as nullable text ) as nullable text

Description

The Guid.From function takes a string (which can be null) as input and converts it into a Guid.Type value. If the input is null, Guid.From conveniently returns a null value.

The function checks the format of the provided input value. For the operation to be successful, the input must adhere to an acceptable format, which we will explore in our examples.

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 Guid.From are:

BI Gorilla Blog

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