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.
I'm trying to figure out how I can toggle row-level fitering or security for a certain use-case. My customers are expecting to be able to toggle between seeing:
Suppose there is a situation where an organization chart exists along the lines of:
Adam | President | ||
Brad | VP | ||
Charlie | Manager |
In a seperate table, suppose cost centers are defined as:
Cost center | #Owner |
001 | Adam |
002 | Adam |
003 | Brad |
004 | Brad |
005 | Charlie |
The user should be able to toggle between these binary options and not have to apply a filter specifying their name, employee number or anything else that isn't a boolean TRUE/FALSE.
I've able to each person to see their data and everyone's beneath them, but can't figure out this toggle situation. Does anyone have a solution for both Adam and Brad being able to toggle between seeing only their own data vs. their entire umbrella's data?
Solved! Go to Solution.
I was able to work out a solution by adding another dimensional table and applying RLS against that.
Now I'm able to throw slicers on the canvas where the end-user specifies DIM_Cost_Center_Selection[Selection] and all visuals (including additional slicers) update accordingly.
░ | |||||||
Cost Center | Cost Center Name | Owner | … | ░ | Cost Center | Email Address | Selection |
001 | Apples | Adam | … | ░ | 001 | Adam@Contoso.com | All |
002 | Bananas | Adam | … | ░ | 002 | Adam@Contoso.com | All |
003 | Carrots | Brad | … | ░ | 003 | Brad@Contoso.com | All |
004 | Dates | Brad | … | ░ | 004 | Brad@Contoso.com | All |
005 | Eggplants | Charlie | … | ░ | 005 | Charlie@Contoso.com | All |
║ | ░ | 001 | Adam@Contoso.com | Mine | |||
╚══════ | ══════ ⇔ | ════ | ══ | ═ | 002 | Adam@Contoso.com | Mine |
░ | 003 | Brad@Contoso.com | Mine | ||||
░ | 004 | Brad@Contoso.com | Mine | ||||
░ | 005 | Charlie@Contoso.com | Mine | ||||
RLS: | Filter on Owner using employee org chart | ░ | RLS: | Or(DIM_Cost_Center_Selection[Email Address]=USERPRINCIPALNAME(), DIM_Cost_Center_Selection[Selection]="All") |
@Anonymous there are lot of blogs/posts available to handle these or similar scenarios, here is link to one, you should pretty much able to change it to meet your needs.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@parry2k ,
Perhaps I didn't explain my problem statement as clearly as I thought. The example you referenced is something I have already solved for, which is using RLS to let "each person see their data and everyone's beneath them." What it doesn't address is enabling a person to easily hide their subordinate's data with the use of a binary option.
Referencing the situation I originally outlined, it was easy for me to use RLS so that:
What I haven't been able to find is being able to use a YES/NO or Mine/All toggle so that:
Yes, I could have a slicer that lists the names of the employees, but if a leader has 100 people below him/her, then it is no longer convenient for the end user to perform "just show me mine."
While I can write the measures necessary to define the logic for what to hide/show,
Edit: Another wrinkle in this situation is that a person can be assigned to multiple RLS roles, so bidirectional filtering is another function that seems to be out-of-the-question....
Regards,
Rob
@Anonymous aha, so let me see if I understood if correctly
- you already solved where a user can see his own department and employee under him, correct?
Problem we need to solve:
there is a selection (may be a slicer) to toggle between
- see his own department only
- see his own and his team department
so based on selection you want to show the data, correct?
If this is correct understanding, I would request you to send me pbix file (remove any sensitive information) and it can be achieved. We have to do the logic in RLS formula based on selection, not thru filter etc.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
I was able to work out a solution by adding another dimensional table and applying RLS against that.
Now I'm able to throw slicers on the canvas where the end-user specifies DIM_Cost_Center_Selection[Selection] and all visuals (including additional slicers) update accordingly.
░ | |||||||
Cost Center | Cost Center Name | Owner | … | ░ | Cost Center | Email Address | Selection |
001 | Apples | Adam | … | ░ | 001 | Adam@Contoso.com | All |
002 | Bananas | Adam | … | ░ | 002 | Adam@Contoso.com | All |
003 | Carrots | Brad | … | ░ | 003 | Brad@Contoso.com | All |
004 | Dates | Brad | … | ░ | 004 | Brad@Contoso.com | All |
005 | Eggplants | Charlie | … | ░ | 005 | Charlie@Contoso.com | All |
║ | ░ | 001 | Adam@Contoso.com | Mine | |||
╚══════ | ══════ ⇔ | ════ | ══ | ═ | 002 | Adam@Contoso.com | Mine |
░ | 003 | Brad@Contoso.com | Mine | ||||
░ | 004 | Brad@Contoso.com | Mine | ||||
░ | 005 | Charlie@Contoso.com | Mine | ||||
RLS: | Filter on Owner using employee org chart | ░ | RLS: | Or(DIM_Cost_Center_Selection[Email Address]=USERPRINCIPALNAME(), DIM_Cost_Center_Selection[Selection]="All") |
Thanks so much for this solution, this works perfectly for me!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
96 | |
77 | |
66 | |
53 |
User | Count |
---|---|
144 | |
105 | |
102 | |
89 | |
63 |