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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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.


@ 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!:
The Definitive Guide to Power Query (M)

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"

@ 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!:
The Definitive Guide to Power Query (M)

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.


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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