Forum Discussion
Anonymous
8 years agoNot applicable
PowerBI RLS
Hi All, I am new to PowerBI I have an table with data like [email protected],[email protected],[email protected] in EmailAddress column. I have created a Role in RLS using Username() function like...
Greg_Deckler
8 years agoCommunity Champion
Right, I think the tricky part will be getting this to work with RLS but I would think that something like this would work:
SEARCH(USERNAME(),[EmailAddress],0,-1)>0
Anonymous
8 years agoNot applicable
Hi Greg,
Thanks for the Reply.
I have used the query given by you to create an Role in RLS.
But I am getting error as attached.
Feedback Type:
Frown (Error)
Timestamp:
2018-04-04T11:22:58.5689871Z
Local Time:
2018-04-04T16:52:58.5689871+05:30
Session ID:
1c62272f-fc9a-4269-9dd2-9cca07e8f9a5
Release:
March 2018
Product Version:
2.56.5023.942 (PBIDesktop) (x64)
Error Message:
An error was encountered during the evaluation of the row level security expression defined on table 'UserDetail'. Error message: Row level security expression defined for the table 'UserDetail' is not of type True/False.
OS Version:
Microsoft Windows NT 10.0.16299.0 (x64 en-US)
CLR Version:
4.7 or later [Release Number = 461308]
Peak Virtual Memory:
34.2 GB
Private Memory:
528 MB
Peak Working Set:
619 MB
IE Version:
11.251.16299.0
User ID:
14338ea1-fde3-4a54-ae82-5696d42acadc
Workbook Package Info:
1* - en-IN, Query Groups: 0, fastCombine: Disabled, runBackgroundAnalysis: True.
Telemetry Enabled:
True
Model Default Mode:
Import
Snapshot Trace Logs:
C:\Users\HP 240 G6\AppData\Local\Microsoft\Power BI Desktop\FrownSnapShot1300755002.zip
Performance Trace Logs:
C:\Users\HP 240 G6\AppData\Local\Microsoft\Power BI Desktop\PerformanceTraces.zip
Disabled Preview Features:
PBI_shapeMapVisualEnabled
PBI_EnableReportTheme
PBI_numericSlicerEnabled
PBI_SpanishLinguisticsEnabled
CustomConnectors
PBI_AdobeAnalytics
PBI_qnaExplore
PBI_variationUIChange
PBI_customVisualsGallery
PBI_canvasTooltips
Disabled DirectQuery Options:
PBI_DirectQuery_Unrestricted
TreatHanaAsRelationalSource
Cloud:
GlobalCloud
DPI Scale:
100%
Supported Services:
Power BI
Formulas:
section Section1;
shared UserDetail = let
Source = Sql.Database(".", "Test", [Query="SELECT DISTINCT ud.vendorcode,#(lf) STUFF((SELECT distinct ',' + p1.emailaddress#(lf) FROM bak_userdetail p1#(lf) WHERE ud.vendorcode = p1.vendorcode#(lf) FOR XML PATH(''), TYPE#(lf) ).value('.', 'NVARCHAR(MAX)')#(lf) ,1,1,'') email#(lf)FROM bak_userdetail ud;"]),
#"Added Custom" = Table.AddColumn(Source, "Emailsearch", each [email]),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Emailsearch"}),
#"Added Index" = Table.AddIndexColumn(#"Removed Columns", "Index", 0, 1),
#"Removed Columns1" = Table.RemoveColumns(#"Added Index",{"Index"})
in
#"Removed Columns1";
shared Vehicle = let
Source = Sql.Database(".", "Test", [Query="select * from vehicle"])
in
Source;- Greg_Deckler8 years agoCommunity Champion
That's what I was afraid of. Perhaps try this:
IF(SEARCH(USERNAME(),[EmailAddress],0,-1)=-1,FALSE(),TRUE())
- Anonymous8 years agoNot applicable
Hi Greg,
Thank for the reply.
I have used the query given by you but I am getting the same error.
I have directly used the query in RLS for creating role.
Do we have any option to list the comma seperated data in power bi.
Is there any alternate solution to handle the data
Please help me on this.
Thanks
- GilbertQ8 years agoSuper UserHi there
I would suggest splitting the data into multiple rows. In doing it in this way it will easily work using RLS