Forum Discussion
rls problem
PATHCONTAINS(Emp[epath],MAXX(FILTER(Emp,Emp[email] = USERPRINCIPALNAME()),Emp[id]))
above role is not working
id name email manager epath
| 1 | krishna | [email protected] | 1 | |
| 2 | testuser1 | [email protected] | 1 | 1|2 |
| 3 | testuser2 | [email protected] | 2 | 1|2|3 |
| 4 | testuser3 | [email protected] | 2 | 1|2|4 |
| 5 | testuser4 | [email protected] | 2 | 1|2|5 |
id sales
| 1 | 100 |
| 2 | 40 |
| 3 | 50 |
| 2 | 45 |
| 4 | 77 |
| 5 | 23 |
Hi Truelearner ,
In Manage roles, you can create roles and try this DAX expression to solve your problem:
IF ( CALCULATE ( COUNTROWS ( 'Emp' ), FILTER ( 'Emp', 'Emp'[email] = USERPRINCIPALNAME () ) ) > 0, [id] = CALCULATE ( MAX ( 'Emp'[id] ), FILTER ( 'Emp', 'Emp'[email] = USERPRINCIPALNAME () ) ), [email] = USERPRINCIPALNAME () )When you use View as roles, you will get the following result:
Here is the demo, please try it:
Best Regards,
Yingjie Li
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
3 Replies
- amitchandak
Super User
Truelearner ,On a Card please check what USERPRINCIPALNAME() is coming. and then check if is matching with email of not
- Truelearner
Helper III
CHECKED ,, I TRIED IN DESKTOP USING USER ROLES AS WELL
I CAN SEND THE FILE IF REQUIRED , CAN YOU TELL ME HOW CAN I ATTACH PBIX HERE I DONT SEE ANY OPTION
ucan download it here
https://drive.google.com/open?id=1OFQ9RsF9ZtxsZVU-JpsYZ1mAXvA-yY_p
- v-yingjl
Community Support
Hi Truelearner ,
In Manage roles, you can create roles and try this DAX expression to solve your problem:
IF ( CALCULATE ( COUNTROWS ( 'Emp' ), FILTER ( 'Emp', 'Emp'[email] = USERPRINCIPALNAME () ) ) > 0, [id] = CALCULATE ( MAX ( 'Emp'[id] ), FILTER ( 'Emp', 'Emp'[email] = USERPRINCIPALNAME () ) ), [email] = USERPRINCIPALNAME () )When you use View as roles, you will get the following result:
Here is the demo, please try it:
Best Regards,
Yingjie Li
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.