Dax Function: INFO.VIEW.RELATIONSHIPS

Category: INFO Functions

The INFO.VIEW.RELATIONSHIPS function in Power BI is a DAX (Data Analysis Expressions) function designed to retrieve metadata about relationships between tables in a data model. It allows users to analyze and document relationships, including their cardinality, direction, and active status.

Purpose

The purpose of the INFO.VIEW.RELATIONSHIPS function is to enable users to explore, validate, and manage relationships within a data model. This is crucial for maintaining the integrity of data models and ensuring correct query behavior.

Type of Calculations it Performs

  • Provides metadata about relationships, including the tables and columns involved.

  • Retrieves relationship attributes such as cardinality, direction, and active/inactive status.

  • Performs non-calculative operations focused on model inspection.

Practical Use Cases

  • Model Validation: Verify relationships in a complex data model to avoid errors in report generation.

  • Schema Documentation: Automatically generate relationship diagrams or documentation for data models.

  • Debugging: Identify and resolve issues caused by inactive or incorrectly configured relationships.

  • Dynamic Analysis: Build reports or visuals that adapt based on relationship metadata.


INFO.VIEW.RELATIONSHIPS()

ParameterTypeDescription
NoneThis function does not require any parameters.
 

How Does INFO.VIEW.RELATIONSHIPS Dax Works

  1. Model Inspection: The function scans the data model to retrieve all relationships defined between tables.

  2. Metadata Retrieval: It collects key properties for each relationship, such as cardinality and direction.

  3. Tabular Output: Returns a table that can be used for analysis or documentation purposes.

Example Formula

Retrieve all relationships in the current data model:

INFO.VIEW.RELATIONSHIPS()

What Does It Return?

The function returns a table with metadata about the relationships in the data model. The table includes the following columns:

  • Relationship Name: The name of the relationship.

  • Table 1: The first table in the relationship.

  • Column 1: The column from the first table.

  • Table 2: The second table in the relationship.

  • Column 2: The column from the second table.

  • Cardinality: Describes the cardinality (e.g., one-to-one, one-to-many).

  • Direction: Indicates the direction of the relationship.

  • Active: A boolean value indicating if the relationship is active.

When Should We Use It?

  • To document relationships for presentations or audits.

  • During model debugging to check for inactive relationships.

  • In dynamic report designs to adapt based on relationship configurations.

Examples

Basic Usage :

Retrieve all relationships in the data model:


INFO.VIEW.RELATIONSHIPS()

Example output:

Relationship NameTable 1Column 1Table 2Column 2CardinalityDirectionActive
Sales_CustomerSalesCustomerIDCustomersCustomerIDOne-to-ManySingleTrue

Column Usage

Extract only the active relationships:


FILTER(INFO.VIEW.RELATIONSHIPS(), [Active] = TRUE)

Advanced Usage

Combine with other functions to analyze relationships dynamically:


SUMMARIZE(INFO.VIEW.RELATIONSHIPS(), [Cardinality], COUNT([Relationship Name]))

This calculates the count of relationships for each cardinality type.

Tips and Tricks

  • Filter Inactive Relationships: Use filters to focus on active or inactive relationships as needed.

  • Combine with Visuals: Pair with visuals to create dynamic diagrams of relationships in the data model.

  • Validate Complex Models: Useful for analyzing models with a large number of interconnected tables.

Potential Pitfalls

  • May return a large table for complex models, which can impact performance.

  • Does not provide details about relationship roles (e.g., primary/foreign key role specifics).

Performance Impact of INFO.VIEW.RELATIONSHIPS DAX Function:

  • Efficient for small to medium-sized models.

  • For larger models, consider filtering results to focus on specific tables or attributes.

Related Functions You Might Need

Want to Learn More?
For more information, check out the official Microsoft documentation for INFO.VIEW.RELATIIONSHIPS You can also experiment with this function in your Power BI reports to explore its capabilities.

Unlock the full capabilities of Power BI and elevate your data insights with our specialized consulting services. Whether you need guidance on advanced DAX functions like those highlighted here, support in designing interactive dashboards, or expertise in optimizing data models for enhanced performance, our experienced Power BI consultants are equipped to deliver customized solutions for your business. Explore our Power BI Consulting Services page to discover how we can help your organization make smarter, data-driven decisions.

1. What does the INFO.VIEW.RELATIONSHIPS function do?

It retrieves metadata about relationships between tables in a Power BI data model.

2. Can I filter the relationships returned by the function?

Yes, you can use DAX functions like FILTER to narrow down the results.

3. What attributes are included in the output of INFO.VIEW.RELATIONSHIPS?

Attributes include relationship name, table names, columns, cardinality, direction, and active status.

4. How does INFO.VIEW.RELATIONSHIPS handle inactive relationships?

The output includes both active and inactive relationships, with a boolean column indicating the status.

5. Is INFO.VIEW.RELATIONSHIPS available for all data models?

It works with tabular models supported in Power BI but may not be compatible with all external data sources.