Forum Discussion
RLS with different tables using LOOKUPVALUE and USERNAME()
- Anonymous9 years ago
Hi Anonymous,
You can use below formula to achieve your requirement.
RLS Formula:
if(
ISERROR(SEARCH("SalesManager", [Role]))=FALSE(),
[SalesManager]=LOOKUPVALUE(Sheet2[User],Sheet2[Login],USERNAME())
,
[SalesMan]=LOOKUPVALUE(Sheet2[User],Sheet2[Login],USERNAME())
)Comment:
Role=LOOKUPVALUE(Sheet2[User],Sheet2[Login],USERNAME())// check the role of current domain
IsManager= if(ISERROR(SEARCH("SalesManager", [Role]))=FALSE(),TRUE(),FALSE()) // check if your role is sales manager
Result:
Notice: USERNAME function has the different result at desktop side and service side, you should deal with this issue.
Service:
Desktop:
Regards,
Xiaoxin Sheng
Hi Anonymous,
You can use below formula to achieve your requirement.
RLS Formula:
if(
ISERROR(SEARCH("SalesManager", [Role]))=FALSE(),
[SalesManager]=LOOKUPVALUE(Sheet2[User],Sheet2[Login],USERNAME())
,
[SalesMan]=LOOKUPVALUE(Sheet2[User],Sheet2[Login],USERNAME())
)
Comment:
Role=LOOKUPVALUE(Sheet2[User],Sheet2[Login],USERNAME())// check the role of current domain
IsManager= if(ISERROR(SEARCH("SalesManager", [Role]))=FALSE(),TRUE(),FALSE()) // check if your role is sales manager
Result:
Notice: USERNAME function has the different result at desktop side and service side, you should deal with this issue.
Service:
Desktop:
Regards,
Xiaoxin Sheng
- Anonymous9 years agoNot applicable
Thanks a lot, I tried workaround to have different tables for SalesMan and SalesManager, but this looks better. Also my original formula had double apostrophe ("") which was wrong.
MV - jphyatt6 years agoFrequent Visitor
Anonymous Are the formulas below "Comment:" measures that are being used to evaluate in the Table filter DAX expression?
- Anonymous3 years agoNot applicable
Anonymous, Thanks for your answers, your fonction works with userprincipalname?