Edit

INFO.LEVELS

Applies to: Calculated column Calculated table Measure Visual calculation DAX query

Returns a table with information about each level in the semantic model. This function provides metadata about hierarchy levels and their properties.

Syntax

INFO.LEVELS ( [<Restriction name>, <Restriction value>], ... )

Parameters

Parameters are optional for this DAX function. When parameters are used, both must be given. More than one pair of parameters is allowed. The restriction name and value are text and entered in double-quotes.

Term Definition
Restriction name Name of the restriction used to filter the results.
Restriction value Value used to filter the results of the restriction.

Restrictions

Typically, all columns of the DAX function results can be used as a restriction. Additional restrictions may also be allowed.

Return value

A table with the following columns:

Column Description
[ID] Unique identifier for the level
[HierarchyID] Identifier of the hierarchy containing this level
[Ordinal] Ordinal position of the level within the hierarchy
[Name] Name of the level
[Description] Description of the level
[ColumnID] Identifier of the column associated with this level
[ModifiedTime] Timestamp of when the level was last modified
[LineageTag] Lineage tag for tracking data lineage
[SourceLineageTag] Source lineage tag from the original data source

Remarks

  • Typically used in DAX queries to inspect and document model metadata.
  • Permissions required depend on the host. Querying full metadata may require model admin permissions.

Example

The following DAX query can be run in DAX query view:

EVALUATE
	INFO.LEVELS()

Example 2 - DAX query with joins

The following DAX query can be run in DAX query view:

EVALUATE
	VAR _Levels =
		SELECTCOLUMNS(
			INFO.LEVELS(),
			"LevelID", [ID],
			"HierarchyID", [HierarchyID],
			"Level Name", [Name],
			"Ordinal", [Ordinal]
		)
	VAR _Hierarchies = 
		SELECTCOLUMNS(
			INFO.HIERARCHIES(),
			"HierarchyID", [ID],
			"Hierarchy Name", [Name]
		)
	VAR _CombinedTable =
		NATURALLEFTOUTERJOIN(
			_Levels,
			_Hierarchies
		)
	RETURN
		SELECTCOLUMNS(
			_CombinedTable,
			"Hierarchy Name", [Hierarchy Name],
			"Level Name", [Level Name],
			"Ordinal", [Ordinal]
		)
	ORDER BY [Hierarchy Name], [Ordinal]

See also