Power BI excels at analyzing data across multiple tables, and two key functions empower this functionality: RELATED and LOOKUP. This tutorial equips you to navigate relationships and extract specific data points based on conditions, unlocking rich insights from your data.
Step 1: Understanding Relationships
- Foreign and Primary Keys: Each table should have a unique identifier (primary key) and a column linking it to another table (foreign key). Establish relationships between tables based on these shared columns.
Step 2: RELATED – Extracting Related Data
- Imagine analyzing sales data with product and customer tables. You want to see the customer name related to a specific product sale.
- Use
RELATED
to access data from a related table based on the current row’s context. - Example:
RELATED('Customers'[Customer Name])
fetches the customer name related to the current product sale (assuming a relationship exists between product and customer tables).
Step 3: LOOKUP – Extracting Specific Values
- Want to analyze sales performance by region, but your region data exists in a separate table? LOOKUP to the rescue!
- LOOKUP searches for a specific value in a designated table based on a search condition and returns a corresponding value from another column.
- Example:
LOOKUPVALUE('Regions'[Sales Performance], 'Regions'[Region Name], SELECTEDVALUE('Products'[Region]))
finds the “Sales Performance” value for the currently selected region (assuming appropriate relationships and columns).
Step 4: Advanced Scenarios
- Multiple LOOKUP arguments: Find values based on multiple criteria by stacking LOOKUP arguments.
- Dynamic filters: Use slicers or other filters to dynamically adjust LOOKUP and RELATED results.
- CALCULATE function: Combine RELATED and LOOKUP within CALCULATE for complex calculations involving related data.
Leave a Reply