Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
BenGWeeks
Regular Visitor

Limit users results based on e-mail address to matching data in table

Hi there,

I have a column that has users e-mail addresses. I have a calculated column as follows to extract the users domain name:

Organisation = MID(DevOpsAssessmentResponses[Email],FIND("@",DevOpsAssessmentResponses[Email])+1,LEN(DevOpsAssessmentResponses[Email])-FIND("@",DevOpsAssessmentResponses[Email]))

When a user logs in to view a report, can I detect their email address (and hence domain name part) and limit the results to data with a matching domain name so they can't see other organisations results?

Many thanks.

Ben

1 ACCEPTED SOLUTION
v-rzhou-msft
Community Support
Community Support

Hi @BenGWeeks 

In addition to timg‘s reply,if you want to restrict the user by their email address to see the data in your report , you can try dynamic RLS in Power BI.

My Sample:

1.png

You need to build a user table as below.

2.png

Relate two tables by Company ID columns.

Manage Roles in Modeling and add table filter expression.

 

 [Company ID]=
CALCULATE (
    MAX ( Data[Company ID] ),
    FILTER ( User, User[User] = USERPRINCIPALNAME() )
) 

 

If I am User1, result is as below.

3.png

User1 can only see values belong to him.

Then you can publish your report on Service and add roles in Security in Dataset.

For more details you may refer to this blog: Dynamic Row Level Security with Power BI Made Simple

Fpr more details about how to add role in service: Validating the role within the Power BI service

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

 

 

View solution in original post

3 REPLIES 3
v-rzhou-msft
Community Support
Community Support

Hi @BenGWeeks 

In addition to timg‘s reply,if you want to restrict the user by their email address to see the data in your report , you can try dynamic RLS in Power BI.

My Sample:

1.png

You need to build a user table as below.

2.png

Relate two tables by Company ID columns.

Manage Roles in Modeling and add table filter expression.

 

 [Company ID]=
CALCULATE (
    MAX ( Data[Company ID] ),
    FILTER ( User, User[User] = USERPRINCIPALNAME() )
) 

 

If I am User1, result is as below.

3.png

User1 can only see values belong to him.

Then you can publish your report on Service and add roles in Security in Dataset.

For more details you may refer to this blog: Dynamic Row Level Security with Power BI Made Simple

Fpr more details about how to add role in service: Validating the role within the Power BI service

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

 

 

timg
Solution Sage
Solution Sage

Hi Ben,

Yes this would be a good case to apply RLS. You can find some more information here: Row-level security (RLS) with Power BI - Power BI | Microsoft Docs.

You can use the USERNAME() and USERPRINCIPALNAME() to add RLS roles based on individual users.

Hope That helps!

Regards,

Tim





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




amitchandak
Super User
Super User

@BenGWeeks , Try like

Organisation = right(DevOpsAssessmentResponses[Email],LEN(DevOpsAssessmentResponses[Email])-FIND("@",DevOpsAssessmentResponses[Email]))

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.