March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe 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
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
Title | Jobtitle | Office | Department |
Micky Mouse | Watch Commander A Sheldon | Sheldon Fire Station - Blue | Binley Fire Station |
Michael Landon | Watch Commander B Hay Mills | Hay Mills Fire Station - White | Hay Mills Fire Station |
Harold LLoyd | Firefighter Sheldon | Sheldon Fire Station - Blue | Sheldon Fire Station |
John Wayne | Firefighter Sheldon | Sheldon Fire Station - Blue | Sheldon Fire Station |
Edward Von Housen | Firefighter Sheldon | Sheldon Fire Station - Blue | Sheldon Fire Station |
Gary Cooper | Firefighter Sheldon | Sheldon Fire Station - Blue | Sheldon Fire Station |
Steven Carlell | Firefighter Hay Mills | Hay Mills Fire Station - White | Hay Mills Fire Station |
Matthew Perry | Firefighter Hay Mills | Hay Mills Fire Station - White | Hay Mills Fire Station |
Paul Potter | Crew Commander Sheldon | Sheldon Fire Station - Blue | Sheldon Fire Station |
Vikki Patterson | Firefighter Hay Mills | Hay Mills Fire Station - White | Hay 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
Solved! Go to Solution.
@gazzo1967 So why not just:
[Office] = "Sheldon Fire Station - Blue"
Then just add the watch commander and crew commanders only to that role.
@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"
@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
JobTitle | Office | ||
Watch Commander B Sheldon | Sheldon Fire Station - White | ||
Crew Commander Sheldon | Sheldon Fire Station - Red | ||
Crew Commander Sheldon | Sheldon Fire Station - Red | ||
Watch Commander B Sheldon | Sheldon Fire Station - Red | ||
Crew Commander Sheldon | Sheldon Fire Station - Green | ||
Watch Commander B Sheldon | Sheldon Fire Station - Green | ||
Crew Commander Sheldon | Sheldon Fire Station - Blue | ||
Crew Commander Sheldon | Sheldon Fire Station - Blue | ||
Firefighter Sheldon | Sheldon Fire Station - Blue | ||
Firefighter Sheldon | Sheldon Fire Station - Blue | ||
Firefighter Sheldon | Sheldon Fire Station - Blue | ||
Firefighter Sheldon | Sheldon Fire Station - Blue | ||
Firefighter Sheldon | Sheldon Fire Station - Blue | ||
Watch Commander B Sheldon | Sheldon 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.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
125 | |
84 | |
68 | |
55 | |
43 |
User | Count |
---|---|
197 | |
107 | |
94 | |
64 | |
56 |