How do I get row where a column value is within another value

HCF
New Member

I have a Contacts table and a Tasks table. The Tasks table has a column for Contacts.
Now I want to see all the Tasks where the Contact appears in Tasks[Contacts]
Is that possible?

Solved Solved
0 9 187
1 ACCEPTED SOLUTION

@HCF

SELECT(
    Tasks[KeyColumn],
    IN(
        [_THISROW].[Contacts],
        SELECT(
            Contacts[ContactName],
            TRUE,
            TRUE
        )
    )
)

View solution in original post

9 REPLIES 9



Hi, although I found some interesting stuff, this was not what I was looking for.
The Tasks[Contacts] field can have several contact names and thus, I want to find only the records where the Contacts[ContactName] appears in Tasks[Contacts]. I realize that this can be done with a relationship, but thatโ€™s not the intention here. Hope this clarifies.

@HCF
You can create a Virtual Column with this expression which will be a LIST type

SELECT(
    Tasks[KeyColumn],
    IN(
        [Contacts],
        Contacts[ContactName]
    )
)

Hi, tanks - I tried that, but it will list all the records - not only the ones where the ContactName appear.

@HCF
Provided you have 100 contacts in your Tasks table and only 20 of them appear in the Contacts table [ContactName] column, the expression will list you 20 of them. Isnโ€™t this what you are asking?

@LeventK
The Tasks table has a field named Contacts. Itโ€™s a text field with several contact names separated by a comma. I am trying to match these records and to show which Tasks appear with the respective ContactName when looking at a Contacts record. That is; the tasks should show on the current contact.

@HCF

SELECT(
    Tasks[KeyColumn],
    IN(
        [_THISROW].[Contacts],
        SELECT(
            Contacts[ContactName],
            TRUE,
            TRUE
        )
    )
)

Thanks a lot, that did the tricks

Youโ€™re very welcome

Top Labels in this Space