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.
Related articles
Learn more about Diagnostics.ActivityId in the following articles:
- The Diagnostics.ActivityId() M Function
Chris Webb delves into using the Diagnostics.ActivityId() M function to identify specific query executions in trace files. This ID simplifies the task of linking trace events to their corresponding queries. » Read more - Understanding Power Query Query Diagnostics Data With The Diagnostics.ActivityID M Function
Chris Webb highlights how the power query engine can evaluate a query multiple times in one refresh. Using the Diagnostics.ActivityId function, he showcases how to identify and trace specific query evaluations. » Read more
Related functions
Other functions related to Diagnostics.ActivityId are:
2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy