Select email if their department is contained in field

I have a simple table named "Admins" that has a field with the persons name and another field for which department they are in. I have another table named "Notifications" that depending on the type of notification it makes a list of which departments that should be notified. Here is an example

Event = New employee                            Notify = "Security, HR, Safety, IT"

My code looks like this

select(admins[email], [Department] = contains(notifications[notify dept], admins[Department]))

Code is good but doesn't return any results. Any ideas on how I can do this?

0 4 226
4 REPLIES 4

I wouldnt say select is very wrong, ive used that exact syntax more times than I can count. I have it working good like this for something else

select(admins[email], [Department] = [_thisrow].[Notify Dept], true) and it returns the values correctly.  

The part im having trouble with is after the = sign. 

select(admins[email] = give me a list of emails from the admins table

select(admins[email], department = give me a list of admins email where their department listed on the admins table is equal to a value in the notify department field

How do I say after the = that is an admins department is in the field notify dept return the email?

The 2nd parameter of SELECT(), the "condition" parameter, expects a yes/no value. It can be any expression that returns such a value, it doesn't have to be a basic equality. You're not asking "does department equal xxx", you're asking "does xxx contain department". Both CONTAINS() and IN() return such a value.

This is what I have now and still returns nothing

select(admins[email], [Department] = in(admins[Department], notifications[Dept notify]))