Query field descriptions

The following query can be used to retrieve the measures in a dataset with descriptions as well as their DAX expression:

SELECT 
[Name] as [Measure Name]
, [Description] as [Measure Description]
, [Expression] as [DAX Expression]
FROM
$SYSTEM.TMSCHEMA_MEASURES
WHERE LEN([Description]) > 1
ORDER BY [NAME];

As shown in the following screenshot, the query can be executed from DAX Studio against the open Power BI Desktop file:

Measure descriptions via DMV query in DAX Studio

The WHERE clause in this query ensures that only measures with a description applied are returned. Removing or commenting out this clause (for example, --WHERE LEN([Description]) > 1) will return all measures whether they have a description or not. Additionally, column aliases of Measure Name, Measure Description, and DAX Expression improve the usability of the DMV columns.

Just as measure descriptions can be retrieved via the the TMSCHEMA_MEASURES DMV, the following query retrieves the column descriptions from the TMSCHEMA_COLUMNS DMV:

SELECT
[ExplicitName] as [Column Name]
, [Description] as [Column Description]
FROM $SYSTEM.TMSCHEMA_COLUMNS
WHERE LEN([Description]) > 1
ORDER BY [ExplicitName];

As per the official documentation referenced earlier in this section, the query engine for DMVs is the Data Mining parser and the DMV query syntax is based on the SELECT (DMX) statement. Therefore, although the queries appear to be standard SQL statements, the full SQL SELECT syntax is not supported, including the JOIN and GROUP BY clauses. For example, it's not possible to join the TMSCHEMA_COLUMNS DMV with the TMSCHEMA_TABLES DMV within the same SELECT statement to retrieve columns from both DMVs. Given these limitations, it can be helpful to build lightweight data transformation processes on top of DMVs, as described in the following section.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.185.196