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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
RashmitaR
Helper IV
Helper IV

DAX for a role

Hi, 

I have a dataset with employee_id,Vertical,hours_avail,Hours_onleave.

I need to write a dax query for a role.The main purpose of creating that role is to restrict the user who is logged in to see only the data related to his vertical.Could some one please help me with a DAX for the same.

Example: If Employee A belongs to Vertical= Ver-123 then when he loggs into his Power BI account and has a look at the dashboard that has been shared by me he should only be able to see the data related to vertical Ver-123 and if thers an employee B belonging to vertical Ver-345 then when he loggs into his Power BI account and has a look at the dashboard that has been shared by me he should only be able to see the data related to vertical Ver-345.

1 ACCEPTED SOLUTION
ankitpatira
Community Champion
Community Champion

@RashmitaR You can make use of Username() function to identify logged in user. In power bi service it will be user's email address. Therefore in your dataset you can include column of user email address and write DAX filter as (suppose column is called UserEmail), [UserEmail] = Username(). Provided these column is in same table, it will be filtered with Vertical column that use belongs to. BTW row level security has now moved from power bi service to power bi desktop with latest power bi desktop update. 

View solution in original post

1 REPLY 1
ankitpatira
Community Champion
Community Champion

@RashmitaR You can make use of Username() function to identify logged in user. In power bi service it will be user's email address. Therefore in your dataset you can include column of user email address and write DAX filter as (suppose column is called UserEmail), [UserEmail] = Username(). Provided these column is in same table, it will be filtered with Vertical column that use belongs to. BTW row level security has now moved from power bi service to power bi desktop with latest power bi desktop update. 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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