Advertisements

What is the Related() function in Power BI?

RELATED() pulls values from different tables based on relationships established in the relationships tab. This is useful and makes it so we don’t necessarily need to append or merge tables to get the same result.

For example, we can create a new calculated column in our fact table Sales that pulls in related information from two other tables without needing to append or merge tables:

PBIDesktop_2018-09-25_10-32-08

Requirements:

  • Calculated column is created in the table that connects all other tables being called in the calculation (so this can’t be created in CampaignDim above, but works in Sales)

Steps:

  1. Create a new calculated column in the fact table (or table connected to all columns about to be referenced)
    PBIDesktop_2018-09-25_10-50-20.png
  2. String/text example:
    • Channel/Cat = RELATED(CampaignDim[TrafficChannel]) & “, ” & RELATED(ProductDim[Category])
  3. Mathematical example:
    • ¬†TotalSales = Sales[Units]*RELATED(ProductDim[UnitCost])

Tips

  • “&” acts to concatenate multiple strings more efficiently than using CONCATENATE()
    • Any text being concatenated to other strings or related values should be inside quotation marks (“”) as the comma is in the example above
  • RELATED() requires established relationships, where LOOKUPVALUE() does not
  • Learn more on the RELATED() function on MSDN
Advertisements

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: