Forum Discussion
Multiple column and Table Query Dependant on values
- 3 years ago
Hi YellowSquirrel ,
Assuming that your Table2 isn't referenced from Table1, then the simplest and clearest way would probably be to merge Table2 onto Table1 on Table1[EmployeeName] = Table2[EmployeeName] and expand Table2[EmployeeNumber].
Then do the same, but on Table1[EmployeeNumber] = Table2[EmployeeNumber] and expand Table2[EmployeeName].
You can now create two new custom columns, something like this:
employeeNumberClean = if [Employee Number] = 0 then [Table2.Employee Number] else [Employee Number] employeeNameClean = if [Employee Name] = "0" then [Table2.Employee Name] else [Employee Name]I've attached a PBIX below with the query to change this:
...to this:
Pete
- 3 years ago
Ah ok apologies, I'll repost there.
Hi YellowSquirrel ,
Assuming that your Table2 isn't referenced from Table1, then the simplest and clearest way would probably be to merge Table2 onto Table1 on Table1[EmployeeName] = Table2[EmployeeName] and expand Table2[EmployeeNumber].
Then do the same, but on Table1[EmployeeNumber] = Table2[EmployeeNumber] and expand Table2[EmployeeName].
You can now create two new custom columns, something like this:
employeeNumberClean =
if [Employee Number] = 0 then [Table2.Employee Number] else [Employee Number]
employeeNameClean =
if [Employee Name] = "0" then [Table2.Employee Name] else [Employee Name]
I've attached a PBIX below with the query to change this:
...to this:
Pete