Forum Discussion

Truelearner's avatar
Truelearner
Icon for Helper III rankHelper III
6 years ago
Solved

rls problem

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

 

 

above role is not working 

 

id       name          email                               manager epath

1krishna[email protected] 1
2testuser1[email protected]11|2
3testuser2[email protected]21|2|3
4testuser3[email protected]21|2|4
5testuser4[email protected]21|2|5

 

id        sales

1100
240
350
245
477
523

 

@mgwena @cham @amitchandak @Greg_Deckler @Mariusz 

  • 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:

    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.

3 Replies

  • v-yingjl's avatar
    v-yingjl
    Icon for Community Support rankCommunity 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:

    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.