Diagnostics.ActivityId

Diagnostics.ActivityId is a Power Query M function that retrieves an opaque identifier for the currently-running evaluation. The function returns a unique identifier for the active evaluation.

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

Syntax

Diagnostics.ActivityId() as nullable text

Description

The Diagnostics.ActivityId function can help in tracing and debugging. This function generates a unique identifier for the current evaluation or query execution. This identifier can help you pinpoint which of the trace files relates to the current query.

For example, let’s say you run a query against a database and are curious about the performance of your query. By adding a custom column populated with the value from Diagnostics.ActivityId(), users can efficiently match trace events to specific query runs, by looking up this exact query id.

Examples

An example output for Diagnostics.ActivityId could be:

Diagnostics.ActivityId() // Output: "b0c5302d-e173-473f-952b-5ffbb55a3934"

Every time the query is refreshed a different value is returned. If you would add this value to the output of your query, for example by using Table.AddColumn, you could use it to lookup the trace events specific to that query run.

Learn more about Diagnostics.ActivityId in the following articles:

Other functions related to Diagnostics.ActivityId are:

BI Gorilla Youtube Channel

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