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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
gazzo1967
Helper III
Helper III

RLS - Help needed to a newbie

HI all
I need some help/direction with RLS.

I would like to create a role.

I need users (who are managers) from my User Information list who login in to do the following:-

 

If their [Jobtitle] = Watch Commander A Sheldon with [office]=Sheldon Fire Station - Blue

or

[Jobtitle] = Crew Commander Sheldon with [office]=Sheldon Fire Station - Blue

 

to be able to view all rows users with [office] = Sheldon Fire Station - Blue only

And the same report to only show

If their [Jobtitle] = Watch Commander A Hay Mills with [office]=Hay Mills Fire Station - White

or

[Jobtitle] = Crew Commander Hay Mills with [office]=Hay Mills Fire Station - White

 

to be able to view all rows users with [office] = Hay Mills Fire Station - White only

 

I,m new to DAX so any help would be appreciated


Data sample
Title             Jobtitle            Office          Department

 

TitleJobtitleOfficeDepartment
Micky MouseWatch Commander A SheldonSheldon Fire Station - BlueBinley Fire Station
Michael LandonWatch Commander B Hay MillsHay Mills Fire Station - WhiteHay Mills Fire Station
Harold LLoydFirefighter SheldonSheldon Fire Station - BlueSheldon Fire Station
John WayneFirefighter SheldonSheldon Fire Station - BlueSheldon Fire Station
Edward Von HousenFirefighter SheldonSheldon Fire Station - BlueSheldon Fire Station
Gary CooperFirefighter SheldonSheldon Fire Station - BlueSheldon Fire Station
Steven CarlellFirefighter Hay MillsHay Mills Fire Station - WhiteHay Mills Fire Station
Matthew PerryFirefighter Hay MillsHay Mills Fire Station - WhiteHay Mills Fire Station
Paul PotterCrew Commander SheldonSheldon Fire Station - BlueSheldon Fire Station
Vikki PattersonFirefighter Hay MillsHay Mills Fire Station - WhiteHay Mills Fire Station


I then have another List with associate data.

I have already made the relationships with my other data and that all works fine.

Regards Gary

1 ACCEPTED SOLUTION

@gazzo1967 So why not just:

[Office] = "Sheldon Fire Station - Blue"

 

Then just add the watch commander and crew commanders only to that role.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

5 REPLIES 5
Greg_Deckler
Super User
Super User

@gazzo1967 Create an RLS role for "Sheldon Fire Station - Blue" and use this expression for the table you show:

([Jobtitle] = "Watch Commander A Sheldon" ||  [Jobtitle] = "Crew Commander Sheldon") && [office]="Sheldon Fire Station - Blue"


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler 
Thank you for replying 🙂
I did that and all it shows me is the two job titles but i need those two roles to be able to see the jobtitle Firefighter Sheldon too.

Basically if the Watch Commander or the Crew Commander login they should be able to see everyone who has the 'office' Sheldon Fire Station - Blue
But doing this only shows those 2 roles.
Sorry if i am coming across a little slow 😞
Gary

@Greg_Deckler 
Sorry will try explain a little more clearly.
If the user logs in and has the [Jobtitle] of either Watch Commander A Sheldon or Crew Commander Sheldon then they need to see all rows with the [Office] = Sheldon Fire Station - Blue.
Can this be done with an IF statement?

OK i got this far 🙂

if([JobTitle] = "Watch Commander B Sheldon" ||[JobTitle] = "Crew Commander Sheldon",

TRUE(), [Office]="Sheldon Fire Station - Blue" )

 

This returns the following

JobTitleOffice  
Watch Commander B SheldonSheldon Fire Station - White
Crew Commander SheldonSheldon Fire Station - Red
Crew Commander SheldonSheldon Fire Station - Red
Watch Commander B SheldonSheldon Fire Station - Red
Crew Commander SheldonSheldon Fire Station - Green
Watch Commander B SheldonSheldon Fire Station - Green
Crew Commander SheldonSheldon Fire Station - Blue
Crew Commander SheldonSheldon Fire Station - Blue
Firefighter SheldonSheldon Fire Station - Blue
Firefighter SheldonSheldon Fire Station - Blue
Firefighter SheldonSheldon Fire Station - Blue
Firefighter SheldonSheldon Fire Station - Blue
Firefighter SheldonSheldon Fire Station - Blue
Watch Commander B SheldonSheldon Fire Station - Blue

 

All I need to do is exclude the entries that are not [Office]Sheldon Fire Station - Blue

Again thanks for the help 🙂

@gazzo1967 So why not just:

[Office] = "Sheldon Fire Station - Blue"

 

Then just add the watch commander and crew commanders only to that role.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

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!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

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