Forum Discussion
Look up laborcode in another row in same table in Dax
- 3 years ago
You can change Operator Total Hrs2 to Return _calc now.
Well now we are getting somewhere.
Going back to the beginning...
We started with...
If you created a calculated column at this point that was
RowHours = codeTable[labourhrs]
It should just pull the labour hours over for all rows except the equipment rows.
Can you double check that this happens in your data?
Assuming that works correctly, we added the Operator Name to each row.
operatorName =
var _nameLookup =
LOOKUPVALUE(codeTable[name],codeTable[Laborcode],codeTable[Equipmentlaborcode])
Return
IF(
OR(ISBLANK(_nameLookup), _nameLookup=""),
[name],
_nameLookup
)
All this is doing looking in the labourcode column for the Equipmentlabourcode and returning whatever the name is for that row. The Equipmentlabourcode and labourcode need to be in the same format for this to work. If this worked correctly the table that results should look like...
Can you verify that this is the result you get?
Let me know how these work and we will go from there.
- ABC113 years ago
Resolver I
Its not pulling Operator name for employee_name.
- jgeddes3 years ago
Super User
I think I see it...
Replace the code as follows (in bold)...
operatorName =
var _nameLookup =
LOOKUPVALUE(codeTable[name],codeTable[Laborcode],codeTable[Equipmentlaborcode])
Return
IF(
OR(_nameLookup=",", _nameLookup=""),
[name],
_nameLookup
)