Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
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
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.