Slice to ensure store managers only see their own staff members

Hi,  I have a user table with all of our staff. They all have  a staff ID and they have a STORE ID dependent on which location they work at. 
There are a few Admin store ID's which can be used to ensure they have oversight over all stores data, but or the store managers we only want them to see information from the sliced table of their own stores data.

I have tried the following:
OR(LOOKUP(USEREMAIL(),EMPLOYEE DETAILS, Management Provided Email,STORE ID)=[_THISROW].[STORE ID],IN(USEREMAIL(),LIST(USER LEVELS[ADMIN])))

It works for the admin side to see all, however it does not work for the store managers.

Any assistance would be greatly appreciated.

0 5 173
5 REPLIES 5

Hi @Cameron_Wilson 

I dont have a solution for you but this type of question pops up about every week. Did you search the forum or help for answers?

OR(
 LOOKUP(USEREMAIL(),EMPLOYEE DETAILS, Management Provided Email,STORE ID)
 =
 [STORE ID],
 IN(USEREMAIL(),USER LEVELS[ADMIN])
)

Cannot be sure because you have not provided all the details for your tables, but one thing I noticed is that you do not need [_THISROW]

Hi @Tee, as I have personal identifiable information in the tables I have not been able to provide a screenshot.

However I will try to better explain myself:

The Table I'm trying to slice is: EMPLOYEE DETAILS

EMPLOYEE DETAILS IS A TABLE FILLED WITH ALL EMPLOYEES. 
EACH EMPLOYEE HAS THE FOLLOWING COLUMNS ATTRIBUTED:
-EMPLOYEE ID (KEY)
-MANAGEMENT PROVIDED EMAIL (THIS IS WHAT THEY WOULD USE TO LOGIN TO THE APPLICATION)
-STORE ID (This relates to a specific location/store that the staff work at and the stores have their own TABLE where STORE ID is the key of the TABLE)

In the app there is a VIEW called EMPLOYEES
In this VIEW  the manager should only see the employees working at this store (LOOKUP(USEREMAIL(),EMPLOYEE DETAILS, Management Provided Email,STORE ID)=[_THISROW].[STORE ID]

However Admin should always be able to see all staff hence the full SLICE, ROW FILTER (OR(LOOKUP(USEREMAIL(),EMPLOYEE DETAILS, Management Provided Email,STORE ID)=[_THISROW].[STORE ID],IN(USEREMAIL(),LIST(USER LEVELS[ADMIN])))

I hope this explains more. 

If I can't get this to work i may need to rethink my approach completely.


 

We typically need definitions and not data content...

Anyway, another thing I noticed. USER LEVEL[ADMIN] returns a list. So List(list) should be just list.

Just putting this here as an update incase anyone else comes across a similar problem, I ended up coming up with a solution.

When filtering the employee data so only managers of one store can see themselves and their staff details, but admin team can see all staff members including each other across multiple (All) stores.

OR(IF(LOOKUP(USEREMAIL(),USERS,"Management Provided Email", STORE ID)="Admin",[STORE ID]=[STORE ID],FALSE),LOOKUP(USEREMAIL(),USERS,"Management Provided Email", STORE ID)=[STORE ID])

Top Labels in this Space