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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Anmolgan
Post Prodigy
Post Prodigy

How to Create A Dax for RLS?

I have a column named company ID that contains various comapnies with differnet employes in them, I need a DAX Query which will give data A/Q to the Company id, suppose if there are 3 employes inside a company and each of them have a companyid 1 then I they should able to see the reports of each other but they cannot be able to see the reports of comanyid 2 and 3, how this can be achived?

I know I can do this by creating different Roles for each companyid, but how can this be achived if I want this to be built in one particular role???

1 REPLY 1
Anonymous
Not applicable

@Anmolgan,

Create the following tables in your scenario, and create relationship among these  tables and your data table.

1.UserCompany table contains two fields(user email address , company id)
2. Users table contains a field(unique user email address)
3. Company table contains unique company id

Then you can add DAX filter "Users[user]=username()" in the Users table, this way, you can achieve dynamic Row level security. There is a blog for your reference.

https://www.kasperonbi.com/power-bi-desktop-dynamic-security-cheat-sheet/

Regards,
Lydia

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.