Forum Discussion
Anonymous
2 years agoNot applicable
TREATAS with variables as inputs
My struggle to learn and comprehend the intricacies of TREATAS continues (not that I'm complaining, learning is fun). Thanks for solving my previous problem, which was mainly self-inflicted by not...
DallasBaba
Skilled Sharer
2 years agoAnonymous you can use the ADDCOLUMNS function to create calculated tables, which preserve the original column names ("Name" and "Brand") from the 'P_A' table. This way, you can use 'P_A' and 'P_B' directly without having to create intermediate tables 'a' and 'b.'
The TREATAS function can then work with these tables without any issues.
VAR A_TreatAs =
TREATAS ( P_B, ADDCOLUMNS(P_A, "Name", P_A[Name], "Brand", P_A[Brand])[ProductKey], P_B[Name], P_B[Brand] )
VAR Result =
NATURALLEFTOUTERJOIN ( P_A, A_TreatAs )
RETURN Result
- Anonymous2 years agoNot applicable
DallasBaba That does not seem to work "Function TREATAS expects a fully qualified column reference as argument number 2."