Slice Filters

I have a users table, which maintains list of users and roles. These roles are more than one and is a enumlist.

3X_b_3_b3e32f6111ec8da7d29165ba8f210e7817f440fd.jpeg

I have a table where i store the menu structure of the app. Each menu item has roles defined.

3X_f_d_fd1149ae00c084eebae78a3643abd4251f7fe5f6.jpeg

I have created slice where i need to filter data based on user roles.

I have used below formula

and([Screen]=โ€œMastersโ€,in(any(logged_user[role]),[Roles]))

At times this doesnt work.

Please assis.

0 5 162
5 REPLIES 5

Steve
Platinum 4
Platinum 4

In what way doesnโ€™t it work?

I have created few forms/views. i wish to restrict these based on roles defined for each users. i have created a table for all form/views and use deeplinks to show these. i have added the roles in this table also.

now i want to show or hide the forms based on the user roles and roles defined in the menu table.

for example.

user โ€œRahul Barveโ€ can access forms assigned to โ€œplanningโ€ and โ€œproductionโ€ since in user master is have assigned him those two.
in the second screenshot, i have tagged forms which can be accessed by which roles.

i hope i was able to make you understand.

i have found some solution right now which is as under:

and([Screen]=โ€œHomeโ€,

IF(
COUNT(logged_user[role])=1,
CONTAINS([roles], ANY(logged_user[role])),
IF(
COUNT(logged_user[role])=2,
OR(
CONTAINS([roles], INDEX(logged_user[role], 1)),
CONTAINS([roles], INDEX(logged_user[role], 2))),
IF(
COUNT(logged_user[role])=3,
OR(
CONTAINS([roles], INDEX(logged_user[role], 1)),
CONTAINS([roles], INDEX(logged_user[role], 2)),
CONTAINS([roles], INDEX(logged_user[role], 3))),
OR(
CONTAINS([roles], INDEX(logged_user[role], 1)),
CONTAINS([roles], INDEX(logged_user[role], 2)),
CONTAINS([roles], INDEX(logged_user[role], 3)),
CONTAINS([roles], INDEX(logged_user[role], 4))))))
)

Maybe this?

ISNOTBLANK(
  INTERSECT(
    logged_user[role]
    [roles]
  )
)

See also:

Steve I like it

I will check that and revert.

thanks.

Top Labels in this Space