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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

July Newsletter

Fabric Community Update - July 2024

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