Bird
Raised Fist0
Power BIbi_tool~20 mins

RELATED for cross-table values in Power BI - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
RELATED Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ dax_lod_result
intermediate
2:00remaining
Calculate Total Sales Using RELATED

You have two tables: Sales with columns OrderID, ProductID, and Quantity, and Products with columns ProductID and Price. You want to create a calculated column in Sales that shows the total sales amount per order line by multiplying Quantity by the Price from Products.

Which DAX formula correctly uses RELATED to get the Price from the Products table?

ATotal Sales = Sales[Quantity] * RELATED(Products[Price])
BTotal Sales = Sales[Quantity] * RELATED(Sales[Price])
CTotal Sales = RELATED(Sales[Quantity]) * Products[Price]
DTotal Sales = Sales[Quantity] * LOOKUPVALUE(Products[Price], Products[ProductID], Sales[ProductID])
Attempts:
2 left
💡 Hint

Remember, RELATED fetches a value from a related table using an existing relationship.

❓ visualization
intermediate
2:00remaining
Visualizing Related Table Data

You have a Customers table and an Orders table related by CustomerID. You want to create a report showing each customer's name and the total number of orders they placed.

Which visualization and measure setup best uses RELATED or related concepts to display this information?

AUse a table visual with Customer Name from <strong>Orders</strong> and a measure: <code>Total Orders = COUNT(Orders[OrderID])</code>
BUse a table visual with Customer Name from <strong>Customers</strong> and a measure: <code>Total Orders = COUNT(Orders[OrderID])</code>
CUse a table visual with Customer Name from <strong>Customers</strong> and a measure: <code>Total Orders = COUNTROWS(RELATEDTABLE(Orders))</code>
DUse a table visual with Customer Name from <strong>Customers</strong> and a calculated column: <code>Order Count = RELATED(Orders[OrderID])</code>
Attempts:
2 left
💡 Hint

Think about how to count related rows from another table.

🧠 Conceptual
advanced
2:00remaining
Understanding RELATED Function Direction

In Power BI, the RELATED function retrieves a value from a related table. Which statement best describes the direction in which RELATED works in a data model?

A<code>RELATED</code> retrieves values from the 'many' side to the 'one' side in a one-to-many relationship.
B<code>RELATED</code> retrieves values only within the same table.
C<code>RELATED</code> retrieves values from the 'one' side to the 'many' side in a one-to-many relationship.
D<code>RELATED</code> retrieves values only between tables with many-to-many relationships.
Attempts:
2 left
💡 Hint

Think about which table has the unique key and which has multiple rows.

🔧 Formula Fix
advanced
2:00remaining
Identify the Error Using RELATED

You wrote this calculated column formula in the Orders table:

Customer City = RELATED(Customers[City])

But you get an error: "The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value."

What is the most likely cause of this error?

AThe <code>Customers[City]</code> column is a calculated table, not a column.
BThe <code>Customers[City]</code> column contains multiple values per customer.
CThe <code>RELATED</code> function is used on the 'one' side instead of the 'many' side.
DThere is no relationship between <strong>Orders</strong> and <strong>Customers</strong> tables.
Attempts:
2 left
💡 Hint

Check if the tables are connected properly.

🎯 Scenario
expert
3:00remaining
Complex Measure Using RELATED in a Many-to-One Scenario

You have three tables: Sales (with OrderID, ProductID, Quantity), Products (with ProductID, CategoryID, Price), and Categories (with CategoryID, CategoryName). Relationships are Sales → Products (many-to-one) and Products → Categories (many-to-one).

You want to create a measure that calculates the total sales amount for a selected category by multiplying Quantity by Price and filtering by CategoryName.

Which DAX measure correctly uses RELATED to achieve this?

ATotal Sales by Category = CALCULATE(SUMX(Sales, Sales[Quantity] * RELATED(Products[Price])), FILTER(Products, RELATED(Categories[CategoryName]) = SELECTEDVALUE(Categories[CategoryName])))
BTotal Sales by Category = CALCULATE(SUMX(Sales, Sales[Quantity] * RELATED(Products[Price])), FILTER(Products, Categories[CategoryName] = SELECTEDVALUE(Categories[CategoryName])))
CTotal Sales by Category = CALCULATE(SUMX(Sales, Sales[Quantity] * RELATED(Products[Price])), FILTER(Sales, RELATED(Products[CategoryID]) = RELATED(Categories[CategoryID]) && RELATED(Categories[CategoryName]) = SELECTEDVALUE(Categories[CategoryName])))
DTotal Sales by Category = CALCULATE(SUMX(Sales, Sales[Quantity] * RELATED(Products[Price])), Products[CategoryID] = RELATED(Categories[CategoryID]) && Categories[CategoryName] = SELECTEDVALUE(Categories[CategoryName]))
Attempts:
2 left
💡 Hint

Remember that RELATED works from many-to-one, and filtering should be done on the correct table.

Practice

(1/5)
1. What does the RELATED function do in Power BI?
easy
A. It creates a new relationship between two tables.
B. It fetches a value from a related table based on existing relationships.
C. It deletes rows from a related table.
D. It aggregates data within the same table.

Solution

  1. Step 1: Understand the purpose of RELATED

    The RELATED function is designed to retrieve a value from another table that is connected through a relationship in the data model.
  2. Step 2: Differentiate from other functions

    RELATED does not create relationships or delete data; it only fetches values from an existing related table.
  3. Final Answer:

    It fetches a value from a related table based on existing relationships. -> Option B
  4. Quick Check:

    RELATED fetches related values = A [OK]
Hint: RELATED pulls data from linked tables only [OK]
Common Mistakes:
  • Thinking RELATED creates relationships
  • Assuming RELATED works without a relationship
  • Confusing RELATED with aggregation functions
2. Which of the following is the correct syntax to use RELATED in a calculated column to get the 'CategoryName' from a related 'Product Categories' table?
easy
A. RELATED('Product Categories'[CategoryName])
B. RELATED(Product Categories[CategoryName])
C. RELATED Product Categories[CategoryName]
D. RELATED[Product Categories.CategoryName]

Solution

  1. Step 1: Recall correct RELATED syntax

    The RELATED function requires the table name in single quotes if it contains spaces or special characters, followed by the column name in square brackets.
  2. Step 2: Check each option

    RELATED('Product Categories'[CategoryName]) uses the correct syntax. Without quotes around the table name with space it fails, missing parentheses fails, and bracket notation is invalid.
  3. Final Answer:

    RELATED('Product Categories'[CategoryName]) -> Option A
  4. Quick Check:

    RELATED syntax with quotes = B [OK]
Hint: Use single quotes around table names with spaces [OK]
Common Mistakes:
  • Omitting quotes around table names
  • Using dot notation inside RELATED
  • Missing parentheses after RELATED
3. Given two tables: Orders with columns OrderID, ProductID, and Quantity, and Products with columns ProductID and Price. There is a relationship between Orders[ProductID] and Products[ProductID]. What will the following calculated column in Orders return?
OrderValue = Orders[Quantity] * RELATED(Products[Price])
medium
A. The total price for each order line by multiplying quantity with product price.
B. The sum of all product prices in the Products table.
C. The quantity multiplied by the total number of products.
D. An error because RELATED cannot be used in calculated columns.

Solution

  1. Step 1: Understand the relationship and calculation

    RELATED fetches the price of the product for each order line by matching ProductID. Multiplying by Quantity gives the total value for that order line.
  2. Step 2: Trace the calculation

    The formula computes the total price for each order line row-by-row by multiplying Quantity with the RELATED product Price. It does not aggregate or error out.
  3. Final Answer:

    The total price for each order line by multiplying quantity with product price. -> Option A
  4. Quick Check:

    Quantity * RELATED(Price) = line total = C [OK]
Hint: RELATED pulls matching row value for each row [OK]
Common Mistakes:
  • Thinking RELATED aggregates values
  • Assuming RELATED cannot be used in calculated columns
  • Confusing multiplication with aggregation
4. You wrote this calculated column in the Sales table:
ProductCategory = RELATED(Product[Category])

But you get an error saying "The column 'Category' either doesn't exist or is not related." What is the most likely cause?
medium
A. The Sales table has duplicate rows causing RELATED to fail.
B. The RELATED function cannot be used in calculated columns.
C. There is no relationship between Sales and Product tables on the relevant keys.
D. The column name 'Category' is misspelled in the Product table.

Solution

  1. Step 1: Analyze the error message

    The error indicates that RELATED cannot find a related row, usually because the tables are not connected by a relationship.
  2. Step 2: Check other possibilities

    RELATED can be used in calculated columns. Misspelling would cause a different error, and duplicates don't cause this error.
  3. Final Answer:

    There is no relationship between Sales and Product tables on the relevant keys. -> Option C
  4. Quick Check:

    RELATED needs relationships = D [OK]
Hint: Check relationships if RELATED gives column not found error [OK]
Common Mistakes:
  • Assuming RELATED works without relationships
  • Ignoring spelling errors in column names
  • Blaming data duplicates for RELATED errors
5. You have three tables: Sales (with ProductID and Quantity), Products (with ProductID, CategoryID, and CategoryName), and Categories (with CategoryID and CategoryName).

You want to create a calculated column in Sales that shows the CategoryName for each sale. Which DAX formula correctly uses RELATED to get this value?
hard
A. RELATED(Categories[CategoryName])
B. RELATED(RELATED(Categories[CategoryName]))
C. RELATED(Products[CategoryID]) & RELATED(Categories[CategoryName])
D. RELATED(Products[CategoryName])

Solution

  1. Step 1: Understand the relationships

    Sales is related to Products by ProductID, and Products is related to Categories by CategoryID. Products contains CategoryName (likely via its own RELATED to Categories).
  2. Step 2: Use RELATED with the correct direct relationship

    RELATED(Products[CategoryName]) fetches from the directly related Products table.
  3. Step 3: Rule out others

    A targets an indirectly related table, C uses invalid concatenation on unrelated data, D has invalid syntax.
  4. Final Answer:

    RELATED(Products[CategoryName]) -> Option D
  5. Quick Check:

    RELATED fetches from directly related table = B [OK]
Hint: RELATED only fetches from directly related tables [OK]
Common Mistakes:
  • Trying to chain RELATED calls
  • Using RELATED on unrelated tables
  • Assuming RELATED can fetch through multiple tables automatically
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard