Forum Discussion
ABC11
Resolver I
3 years agoLook up laborcode in another row in same table in Dax
Hi, I have laborcode(employee no), name and laborhrs in one row And euipment, equipmenthrs , equilaborcode in different row. Laborcode and equilaborcode is same. I would like to identify operato...
- 3 years ago
You can change Operator Total Hrs2 to Return _calc now.
ABC11
Resolver I
3 years agoOnly this is not working.
Operator Total HRs =
CALCULATE(
sum('LEM FACT with query'[LABORHRS]),
ALLEXCEPT('LEM FACT with query','LEM FACT with query'[EMPLOYEE_NAME],'LEM FACT with query'[WORKDATE]))
Operator Name formula is working
Thanks
jgeddes
Super User
3 years agoI just needed to see what you named the Operator Name column.
The name column that is referenced in the ALLEXCEPT statement needs to be the "Operator Name" column, not the original Employee Name column.
- ABC113 years ago
Resolver I
When I change to OpratorName column still not workingOperator Total HRs =CALCULATE(sum('LEM FACT with query'[LABORHRS]),ALLEXCEPT('LEM FACT with query','LEM FACT with query'[OparatorName],'LEM FACT with query'[WORKDATE]))OparatorName =var _nameLookUp=LOOKUPVALUE('LEM FACT with query'[EMPLOYEE_NAME],'LEM FACT with query'[LABORCODE],'LEM FACT with query'[EQUIPLABORCODE])Returnif(or(ISBLANK(_nameLookUp), _nameLookUp=""),'LEM FACT with query'[EMPLOYEE_NAME],_nameLookUp)Please,Thanks for your help- jgeddes3 years ago
Super User
Ok, let us change the Operator Total Hours calculated column to this...
Operator Total Hours2 =
var _operatorName =
codeTable[operatorName]
var _workDate =
codeTable[Workdate]
var _calc =
CALCULATE(
SUM(codeTable[laborhrs]),
FILTER(ALL(codeTable), codeTable[operatorName] = _operatorName && codeTable[Workdate] = _workDate)
)
Return
_calc- ABC113 years ago
Resolver I
Sorry- Didn't workOperator Total HRs2 =VAR _OperatorName='LEM FACT with query'[OparatorName]VAR _workdate='LEM FACT with query'[WORKDATE].[Date]VAR _calc =Calculate(sum('LEM FACT with query'[LABORHRS]),FILTER(ALL('LEM FACT with query'),'LEM FACT with query'[OparatorName]=_OperatorName && 'LEM FACT with query'[WORKDATE].[Date]=_workdate))Return_calcPlease, look it again for meThanks