Forum Discussion
RLS query with Multiple columns, Columns differ basis of condition.
- 3 years ago
Solved:
- On the basis of Email, I already done for both (Main Table and UserMapping)
- But my case is different from point 1, there is no relation.
What I did here,
- Output from UserMapping on the basis of Email (like Country,Team,Process,Combination of Country and Team,Combination of Team and Process etc.)
- Get desire output from Main Table on the basis of Point 1 (Output)
- As there are no relation between these tables, what I did, Consider UserMapping Output as a Input for Main Table.
Syntax : Manage Role sections only.
VAR _upn=USERPRINCIPALNAME()
VAR _Country='Main Table'[Country] IN CALCULATETABLE(VALUES(' UserMapping '[Country]),' UserMapping '[EMail]=_upn)
VAR _CountryAndProcess='Main Table'[CountryAndProcess] IN CALCULATETABLE(VALUES('UserMapping'[CountryAndProcess]),' UserMapping '[EMail]=_upn)
VAR _None='Main Table'[CountryAndTeam] IN CALCULATETABLE(VALUES('UserMapping'[CountryAndTeam]),' UserMapping '[EMail]="None")
return
IF(_TypeMapping="ABC" && CONTAINSSTRING([_RoleMapping],"Manager") ,_Country
,IF(_TypeMapping="XYZ" && (CONTAINSSTRING([_RoleMapping],"Country Head") || CONTAINSSTRING([_RoleMapping],"Developer")) ,_CountryAndProcess,_None))
Solved:
- On the basis of Email, I already done for both (Main Table and UserMapping)
- But my case is different from point 1, there is no relation.
What I did here,
- Output from UserMapping on the basis of Email (like Country,Team,Process,Combination of Country and Team,Combination of Team and Process etc.)
- Get desire output from Main Table on the basis of Point 1 (Output)
- As there are no relation between these tables, what I did, Consider UserMapping Output as a Input for Main Table.
Syntax : Manage Role sections only.
VAR _upn=USERPRINCIPALNAME()
VAR _Country='Main Table'[Country] IN CALCULATETABLE(VALUES(' UserMapping '[Country]),' UserMapping '[EMail]=_upn)
VAR _CountryAndProcess='Main Table'[CountryAndProcess] IN CALCULATETABLE(VALUES('UserMapping'[CountryAndProcess]),' UserMapping '[EMail]=_upn)
VAR _None='Main Table'[CountryAndTeam] IN CALCULATETABLE(VALUES('UserMapping'[CountryAndTeam]),' UserMapping '[EMail]="None")
return
IF(_TypeMapping="ABC" && CONTAINSSTRING([_RoleMapping],"Manager") ,_Country
,IF(_TypeMapping="XYZ" && (CONTAINSSTRING([_RoleMapping],"Country Head") || CONTAINSSTRING([_RoleMapping],"Developer")) ,_CountryAndProcess,_None))