Row filter condition in Slice to get the last Action Row of each Client

Nadim1
New Member

Hi,

Iโ€™m new here and, and just finished my first App with one unsolved issue, and need your help please.

I have 3 tables in my App and each has many columns, but Iโ€™ll mention the required columns only
1st, Salesmen, (Name, Email)
2nd, Clients, (Client ID, Salesman, Status)
3rd, Actions, (Client ID)

What I need is a Slice to show the last Action of each of my clients only that donโ€™t have Status โ€œNot Interestedโ€ or โ€œOrderedโ€

Ex: Each client may has more than one action, sorted by date, so I need to show the last action only, for those clients that assigned to me and donโ€™t have Status โ€œNot Interestedโ€ or โ€œOrderedโ€

I used this expression and it worked but I need the last row only if all condition are true
1st, (Check my Clients) LOOKUP(USEREMAIL(), โ€œPartnersโ€, โ€œEmailโ€, โ€œNameโ€)=LOOKUP([Client ID], โ€œClientsโ€, โ€œClient IDโ€, โ€œSalesmanโ€)
2nd, (Same 1st, but only if their Status are not โ€œNot Interestedโ€ or โ€œOrderedโ€)
3rd, (Show me the Last Row of the clients that meets the above conditions)

Thanks in advanced

Solved Solved
0 7 206
1 ACCEPTED SOLUTION

Try this:

AND(
  NOT(IN([Status], LIST("Not Interested", "Ordered"))),
  (USEREMAIL() = [Client ID].[Salesman].[Email]),
  (
    [_ROWNUMBER]
    = MAX(
      SELECT(
        Actions[_ROWNUMBER],
        AND(
          NOT(IN([Status], LIST("Not Interested", "Ordered"))),
          ([_THISROW].[Client ID] = [Client ID])
        )
      )
    )
  )
)

See also:

View solution in original post

7 REPLIES 7

Youโ€™ll Need to use MAX() to find either the highest [_RowNumber] or [DateTime]

Thank you Simon, but my problem is that Iโ€™m not able to combine all the expressions together, I tried several ways but still didnโ€™t get the correct one

Do you need to see this in the Salesman record or the Client record?

In my Action table, I have added many actions for each client, so I need a slice to show me only the last action of this client just incase it match the following conditions
1- If this is my client LOOKUP(USEREMAIL(), โ€œPartnersโ€, โ€œEmailโ€, โ€œNameโ€)=LOOKUP([Client ID], โ€œClientsโ€, โ€œClient IDโ€, โ€œSalesmanโ€)
2-If the Status of this client is not โ€œNot Interestedโ€ or not โ€œOrderedโ€

Nadim1
New Member

Any help please?

Try this:

AND(
  NOT(IN([Status], LIST("Not Interested", "Ordered"))),
  (USEREMAIL() = [Client ID].[Salesman].[Email]),
  (
    [_ROWNUMBER]
    = MAX(
      SELECT(
        Actions[_ROWNUMBER],
        AND(
          NOT(IN([Status], LIST("Not Interested", "Ordered"))),
          ([_THISROW].[Client ID] = [Client ID])
        )
      )
    )
  )
)

See also:

Thank you so much, this is exactly what I need

Top Labels in this Space