Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi, I have this problem
Have several tables that I need to try to combine in one.
Main table = OLRR
Second table = OLMPDirekta
OLRR and OLMPDirekta I want to create a custom column called OLNyResultat in OLRR and the code should be something like this "if CostType = Absorption (DL) then match Date and CostCenter columns between OLRR and OLMPDirekta and return column DiffNyOLMPDirekta from OLMPDirekta"
the code I have so far with help from GTP is this
"if [CostType] = "Absorption (DL)" then
let
matchingRows = Table.SelectRows(OLMPDirekta, each [Date] = [Date] and [CostCenter] = [CostCenter]),
result = if Table.RowCount(matchingRows) > 0 then matchingRows{0}[DiffNyOLMPDirekta] else null
in
result
else null"
But the problem here is that it's not returning the right answer except on the first match.
Table OLMPDirekta
Result in OLRR from the code above
It gives me result from 202301 which was 2 to all other months 202302, 202303 etc but these should be 1
Any ideas on how to make this work?
Hi,
try
(x) => if [CostType] = "Absorption (DL)" then
let
matchingRows = Table.SelectRows(OLMPDirekta, each x[Date] = [Date] and x[CostCenter] = [CostCenter]),
result = if Table.RowCount(matchingRows) > 0 then matchingRows{0}[DiffNyOLMPDirekta] else null
in
result
else null
or
(x) => if [CostType] = "Absorption (DL)" then
List.First(
Table.SelectRows(OLMPDirekta, each x[Date] = [Date] and x[CostCenter] = [CostCenter])[DiffNyOLMPDirekta],
null)
else null
Stéphane
Hi,
When I try both of the codes I get a function result.
When I click on it I get this popup
I click Ok without typing in anything and the result is this
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.