Forum Discussion
WBADAM03
3 years agoFrequent Visitor
Conditional column based on if a record exists in another table
Hey all, I hope this is the right place to ask this question: I have table1 that has a list of students. I have table2 that has a table with student records. I want to have a column in ta...
- Anonymous3 years ago
Hi WBADAM03 ,
I created some dummy data for reference.
Table (1) has the student's names, Table (2) has the students' grades, and if the student in Table (1) has no grades in Table (2), then NA is returned.
Then you can create the following column to solve it.
Column = IF( 'Table (1)'[Student] in SELECTCOLUMNS('Table (2)',"Student",[Student]),"Y","NA")Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
AlienSx
3 years agoSuper User
table2_rec = Record.FromList(table2[data_value], table2[key]),
find_key = Table.AddColumn(table1, "column", each Record.FieldOrDefault(table2_rec, [key], "NA"))