Filter slice to find record based on values in another table

I try to filter records in slice from table Contacts based on values in table Activities with this expression,
In(
Contacts[UniqueID] ,
OrderBy( Select( Activities[Contacts], True ), [LastSelect] )
)
, but it will not let me do that. Please let me know what I am doing wrong?
image

What are you trying to accomplish, specifically?

ORDERBY() sorts a list of rows; it does not filter them.

Select( Activities[Contacts], True ) can be written simply as Activities[Contacts].

In what table is the LastSelect column?

3 Likes

@Steve - I am trying to get the latest record selected (I have an action to set the value of the selected record of the Activities table) - “LastSelected” type DateTime.
Then, I want to filter records in the Contacts table where the UniqueID is in list Activities[Contacts] through a filter on the slice of Contacts.
Hope that makes sense.

So you want the [contacts] of the last selected record in the Activities table? And then filter the contacts table on whether they are in that [contacts]?

2 Likes

@Austin_Lambeth - yes, that’s right.

So first recommendation is just make a MAX_Activities slice with a formula similar to this
[CurrentTimeStamp]

=
MAX(
SELECT(
CurrentInvoice[CurrentTimeStamp],
[UserEmail]=USEREMAIL()
)
)

I don’t know how you’re Activities table is set up exactly but basically this slice is to filter down to the row you want just to make it easier to user in many places. From there you would just do IN([UniqueID],ANY(SELECT(MAX_ACTIVITIES[CONTACTS],true))

Slice filters are performed row by row so you don’t need Contacts[UniqueID]. I assume [Contacts] is a list column correct?

(what the heck happened to my text :no_mouth: I was just trying to format the code and this happened)

2 Likes

@Austin_Lambeth - perfect!!
Thanks for helping - that did the tricks.