The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
I am implementing Dynamic row level security in my Power BI report.
Attached is a sample report and excel.
https://drive.google.com/drive/folders/1Wg1jgWRRTKrDi17DtKmIxCADsvtR1AW8
I have created below role for row level security which is defined against table EmpId.
'EmpId' table is a bridge table between the 'Main table' and 'WC_EMPLOYEE_HIERARCHY_DASH_DI' table which contains unique empids.
VAR user_Var=
CALCULATETABLE (
VALUES ( WC_EMPLOYEE_HIERARCHY_DASH_DI[emp_ad] ),
WC_EMPLOYEE_HIERARCHY_DASH_DI[Supervisor_ad] =
UserName()
)
RETURN
EmpIds[emp_ad] IN user_Var
I want to add a new condition in the role to check if logged in user is present in 'EmpId' table then evaluate the above expression and return corresponding data but if it is not present then check in 'Proxy table' and use the corresponding proxy_username and return the related data.
For that I added one more expression,
var proxy=
CALCULATEtable(
values(Proxy_Table[Proxy_Username]),
Proxy_Table[Username]=
UserName()
)
)
return
proxy_Table[proxy_username] in proxy
Both of this expressions work fine individually but I want to add if else condition to check if its present in the UserIds table and if not then use Proxy table username.
Can anyone please help me on that?
Thanks,
Rinku
Hi, @Anonymous
Based on your description, I created data to reproduce your scenario. The pbix file is attacehd in the end.
Table:
You may create a new role as below.
If(
userprincipalname()="a@123.com",
[Email]=userprincipalname(),
OR(
[Email]="b@123.com",
[Email]="c@123.com"
)
)
Result:
Best Regards
Allan
If this post helps,then consider Accepting it as the solution to help other members find it faster.
Hi @v-alq-msft ,
Thank you so much for your reply. Actually my requirement is quite different. If the logged In user is not present in 1st table (Hierarchy' table) then use proxy from 2nd table. Somehow I am having difficulty while managing one user roles with 2 different tables and adding if condition.
The main requirement is, we have 'Hierarchy' table where the manager-employee hierarchy is defined. If the logged in user is not present in the Hierarchy table then he should be login as some proxy user. So we define other proxy table. But is it possible to achieve that by some other way or dynamically without building 'Proxy' table and by passing some parameters when user logs in?
Thanks,
Rinku