Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Truelearner
Helper III
Helper III

rls problem

PATHCONTAINS(Emp[epath],MAXX(FILTER(Emp,Emp[email] = USERPRINCIPALNAME()),Emp[id]))

 

 

above role is not working 

 

id       name          email                               manager epath

1krishnakrishna@taged.onmicrosoft.com 1
2testuser1tester1@taged.onmicrosoft.com11|2
3testuser2tester2@taged.onmicrosoft.com21|2|3
4testuser3tester3@taged.onmicrosoft.com21|2|4
5testuser4tester4@taged.onmicrosoft.com21|2|5

 

id        sales

1100
240
350
245
477
523

 

@mgwena @cham @amitchandak @Greg_Deckler @Mariusz 

1 ACCEPTED SOLUTION
v-yingjl
Community Support
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:

view as roles.pngRole result.png

Here is the demo, please try it:

PBIX 

 

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.

View solution in original post

3 REPLIES 3
v-yingjl
Community Support
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:

view as roles.pngRole result.png

Here is the demo, please try it:

PBIX 

 

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.

amitchandak
Super User
Super User

@Truelearner ,On a Card please check what USERPRINCIPALNAME() is coming.  and then check if is matching with email of not

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.