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.
hello I have this table with the accesses that each user must have.
furthermore i created this rule, however with use the maxx is only the last value is returned
example: user4@company.com should have access to "AAABBBCCCEEE" and "AAABBBCCCFFF".
with the current rule he only has access to "AAABBBCCCEEE".
Every help is welcome.
Thanks a lot for the help.
plaese apologize for my English
access level | Name | Parent | Hierarchy | |
user1@company.com | AAA | AAA | AAA | |
user2@company.com | AAABBB | BBB | AAA | AAA | BBB |
user3@company.com | AAABBBCCC | CCC | BBB | AAA | BBB | CCC |
user4@company.com | AAABBBCCCEEE | EEE | CCC | AAA | BBB | CCC | EEE |
user4@company.com | AAABBBCCCFFF | FFF | CCC | AAA | BBB | CCC | FFF |
user5@company.com | AAABBBCCCHHH | HHH | CCC | AAA | BBB | CCC | HHH |
the rule
PATHCONTAINS(User[Hierarchy],
MaxX(
Filter(
User,
[Email]=USERPRINCIPALNAME()
)
,IF(User[Parent]="",User[Name],User[Name])
)
)
Solved! Go to Solution.
Hi @Anonymous ,
As the formula in the link you refer to you should create:
Org Level 4 = LOOKUPVALUE (
User[Email],
User[Name],
PATHITEM ( 'User'[Hierarchy], 4)
)
Org Level 3 = LOOKUPVALUE (
User[Email],
User[Name],
PATHITEM ( 'User'[Hierarchy], 3)
)
Org Level 2 = LOOKUPVALUE (
User[Email],
User[Name],
PATHITEM ( 'User'[Hierarchy], 2)
)
Org Level 1 = LOOKUPVALUE (
User[Email],
User[Name],
PATHITEM ( 'User'[Hierarchy], 1)
)
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
Hi Joaoar,
I had similar requirement and below is how I solved it.
Access Level | Name | Hierarchy | Role_Order | First_Role | Second_Role | |
user1@company.com | AAABBB | BBB | AAA | BBB | 1 | BBB | |
user2@company.com | AAABBBCCC | CCC | AAA | BBB | CCC | 1 | CCC | |
user3@company.com | AAABBBCCCEEE | EEE | AAA | BBB | CCC | DDD | EEE | 1 | EEE | |
user3@company.com | AAABBBCCCFFF | FFF | AAA | BBB | CCC | FFF | 2 | FFF |
Role_Order: New column using Power Query editior. (Link: https://youtu.be/7CqXdSEN2k4)
First_Role: Calculated column Dax: If(Role_Order = 1,Name).
Second_Role: Calculated column Dax: If(Role_Order = 2,Name).
RLS:
PATHCONTAINS(User[Hierarchy],
Maxx(
Filter(
User,
[Email]=USERPRINCIPALNAME()
)
, User[First_Role]
)
) | |
PATHCONTAINS(User[Hierarchy],
Maxx(
Filter(
User,
[Email]=USERPRINCIPALNAME()
)
, User[Second_Role]
)
)
Thanks.
@Anonymous ,
Try RLS
https://community.powerbi.com/t5/MBAS-Gallery/Microsoft-Power-BI-Unleash-row-level-security-patterns-in-Power/td-p/712613
https://radacad.com/dynamic-row-level-security-with-organizational-hierarchy-power-bi
https://www.blue-granite.com/blog/using-dynamic-row-level-security-with-organizational-hierarchies
https://docs.microsoft.com/en-us/power-bi/service-admin-rls
https://blog.tallan.com/2018/04/10/row-level-security-in-power-bi-part-1-roles-and-users/
https://radacad.com/what-do-you-need-to-implement-dynamic-row-level-security-in-power-bi
hi @amitchandak
Thanks for your help but it didn't work.
i followed this toturial https://radacad.com/dynamic-row-level-security-with-profiles-and-users-in-power-bi but it doesn't work because it doesn't use hierarchy.
that is, user user1@company.com must see all records. the user user3@company.com should see everything below him (and himself) and the user user5@company.com should only see himself.
any idea how to do this?
thank you very much
@Anonymous , have you checked this one.
https://www.blue-granite.com/blog/using-dynamic-row-level-security-with-organizational-hierarchies
hi @amitchandak
I've been following the tutorial. I do not want to give access by the number of employees but by the level of access. so I had to make some changes to the tuturial formula,
as the LOOKUPVALUE function does not support comparisons between texts it is not possible to follow the toturial.
thanks for your help.
Any idea how to continue?
formula in toturial:
Org Level 4 = LOOKUPVALUE (
'Organization'[Email - Work],
'Organization'[Employee ID],
PATHITEM ( 'Organization'[Organizational Hierarchy], 4, 1 )
)
my formula:
Org Level 4 = LOOKUPVALUE (
User[Email],
User[last nivel],
PATHITEM ( 'User'[Hierarchy], 4, 1 )
)
last nivel = IF(User[Parent]="",User[Name],User[Name])
Hi @Anonymous ,
As the formula in the link you refer to you should create:
Org Level 4 = LOOKUPVALUE (
User[Email],
User[Name],
PATHITEM ( 'User'[Hierarchy], 4)
)
Org Level 3 = LOOKUPVALUE (
User[Email],
User[Name],
PATHITEM ( 'User'[Hierarchy], 3)
)
Org Level 2 = LOOKUPVALUE (
User[Email],
User[Name],
PATHITEM ( 'User'[Hierarchy], 2)
)
Org Level 1 = LOOKUPVALUE (
User[Email],
User[Name],
PATHITEM ( 'User'[Hierarchy], 1)
)
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
Thank you so much for your answer.
it solves the problem if I have a user for each access level. but if I want user123@company.com and user1@company.com to have AAA access level I get this error "A table of multiple values was supplied where a single value was expected."
access level | Name | Parent | Hierarchy | |
user123@company.com | AAA | AAA | AAA | |
user1@company.com | AAA | AAA | AAA |
can you help please?
thank you very much
Hi @Anonymous ,
When you use looupvalue, if multiple values are returned, this error will be reported under one filter condition. And you can use firstnonblank function.
Please refer to https://community.powerbi.com/t5/Desktop/LOOKUPVALUE-quot-A-table-of-multiple-values-was-supplied-where-a/td-p/331656
Best Regards,
Dedmon Dai
Hello @v-deddai1-msft
I apologize for the delay in replying but I was on vacation so I didn't have access to my account.
i understand i can't use looupvalue but what should i use. I need several users to have the same level of access. Please help me.
thank you
Hi @Anonymous ,
I'm doubt why you use MAXX. Please try the followinng dax:
CALCULATE(IF(User[Parent]="",User[Name],User[Name]),Filter(User,[Email]=USERPRINCIPALNAME()))
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
i'm sorry i forgot to put PATHCONTAINS in the rule.
i need maxx because of PATHCONTAINS.
is there any other solution?
Thanks in advance
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
97 | |
85 | |
67 | |
59 |
User | Count |
---|---|
150 | |
120 | |
99 | |
87 | |
68 |