🔗 Relationships

Goal: Fetch data across tables.
RELATED: Pulls info from the "One" side (Lookup).
RELATEDTABLE: Counts rows on the "Many" side (Fact).

Fact: Sales Table (Many Side)
Lookup: Product Table (One Side)
Ready...

💻 DAX Formula

-- Scenario 1: Fetch Price from Lookup Table
COLUMN Revenue = Sales[Qty] * RELATED( Product[Price] )
-- "Go look up the Price for this product"

-- Scenario 2: Count Sales for each Product
COLUMN Txn_Count = COUNTROWS( RELATEDTABLE( Sales ) )
-- "Go count how many times this product appears in Sales"
Relationship:
Sales[*] ────── related to ────── Product[1]