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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.