Trying to set a security filter 'Orders Table' : where it only shows each users their orders

and(ANY(SELECT(AOD[Salesperson ID], ([Email] = useremail())))=[SalesPerson],[Order Date]>=today()-12)
Above formula works perfect and shows each user all their orders.

However i need it to show their Splitsale too:: So at the end of the day, if the users name pops up in either field as [salesperson] or [splitsale], then i need that user to have access to it.
[Salesperson], [Splitsale] : Both are fields in Orders Table that chooses reps name.

I wrote it several ways but doesnt seem to work. Any ideas

Solved Solved
0 9 172
1 ACCEPTED SOLUTION

AND(
  ([Order Date] >= (TODAY() - 12)),
  ISNOTBLANK(
    INTERSECT(
      LIST(
        [Salesperson],
        [SplitSale]
      ),
      SELECT(
        AOD[Salesperson ID],
        (USEREMAIL() = [Email])
      )
    )
  )
)

View solution in original post

9 REPLIES 9

Hi @Rurrea
Have you tried using OR() ?

Tried the โ€œorโ€ option but it misreads it

No, youโ€™re misusing it.

Or(and(ANY(SELECT(AOD[Salesperson ID], ([Email] = useremail())))=[SalesPerson], and(ANY(SELECT(AOD[Salesperson ID], ([Email] = useremail())))=[Splitsale]),[Order Date]>=today()-12)

Tried something like this but it misreads it and just ends up filtering all orders 12 days back for everyone

What Iโ€™m I doing wrong or what would u do? Would love to figure this out tonight

Your logic is wrong, the general syntax should be

AND(
  date comparison ,
  OR(
    [salesperson] comparison ,
    [splitsale] comparison
  )
)

And([Order Date]>=today()-12,or(ANY(SELECT(AOD[Salesperson ID], ([Email] = useremail())))=[SalesPerson], ANY(SELECT(AOD[Salesperson ID], ([Email] = useremail())))=[splitsale]))

Solution still didnโ€™t work. Unless Iโ€™m doing it wrong

AND(
  ([Order Date] >= (TODAY() - 12)),
  ISNOTBLANK(
    INTERSECT(
      LIST(
        [Salesperson],
        [SplitSale]
      ),
      SELECT(
        AOD[Salesperson ID],
        (USEREMAIL() = [Email])
      )
    )
  )
)

Worked perfectly

Top Labels in this Space