0
0
Power BIbi_tool~10 mins

Multiple data sources in one report in Power BI - Cell-by-Cell Formula Trace

Choose your learning style9 modes available
Sample Data

Two data tables: Sales data (A1:C4) and Product details (E1:G3) from different sources.

CellValue
A1SalesID
B1ProductID
C1Quantity
A2101
B2P01
C25
A3102
B3P02
C33
A4103
B4P01
C42
E1ProductID
F1ProductName
G1Price
E2P01
F2Notebook
G210
E3P02
F3Pen
G32
Formula Trace
SUMX(RELATEDTABLE(Products), Sales[Quantity] * Products[Price])
Step 1: RELATEDTABLE(Products) for Sales row with ProductID 'P01'
Step 2: Sales[Quantity] * Products[Price] for ProductID 'P01' with Quantity 5 and Price 10
Step 3: RELATEDTABLE(Products) for Sales row with ProductID 'P02'
Step 4: Sales[Quantity] * Products[Price] for ProductID 'P02' with Quantity 3 and Price 2
Step 5: RELATEDTABLE(Products) for Sales row with ProductID 'P01' (third row)
Step 6: Sales[Quantity] * Products[Price] for ProductID 'P01' with Quantity 2 and Price 10
Step 7: SUMX over all rows: 50 + 6 + 20
Cell Reference Map
  A      B        C       E       F          G
+-----+--------+-------+-------+---------+-------+
|SalesID|ProductID|Quantity|ProductID|ProductName|Price |
| 101  |  P01   |   5   |  P01  | Notebook |  10   |
| 102  |  P02   |   3   |  P02  | Pen      |   2   |
| 103  |  P01   |   2   |       |          |       |
+-----+--------+-------+-------+---------+-------+
  ^       ^        ^       ^       ^          ^
  |       |        |       |       |          |
  |       |        |       |       |          |
  +-------+--------+-------+-------+----------+
References link Sales[ProductID] to Products[ProductID], Sales[Quantity] to Products[Price]
Shows how Sales table columns (A-C) relate to Products table columns (E-G) by ProductID.
Result
  A      B        C       H
+-----+--------+-------+-----+
|SalesID|ProductID|Quantity|Total|
| 101  |  P01   |   5   |  50 |
| 102  |  P02   |   3   |   6 |
| 103  |  P01   |   2   |  20 |
+-----+--------+-------+-----+

Grand Total Sales Amount: 76
Final calculated sales amount per row and total sum combining data from both sources.
Sheet Trace Quiz - 3 Questions
Test your understanding
What does RELATEDTABLE(Products) do in this formula?
AFinds matching product rows for each sales row
BCalculates total sales quantity
CFilters sales rows by quantity
DAdds prices from all products
Key Result
SUMX iterates over related rows from another table, multiplying and summing values.