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
AlexGurovich
Helper II
Helper II

Slicer Options depending on logged in User

Hi Everyone:
 
I would like a Slicer that I have in one of my pages to expose (or not expose)  products from the PRODUCTS Table based on the USER that is logged in from the Power BI service. So, for some USER, some subset of PRODUCTS should be exposed, and for some other USER another subset of PRODUCTS should be exposed.
 
How do I do that?  (NOTE:  I think RLS won't work for me, because RLS will expose (or not expose) those same PRODCUTS from all other visualizations (other graphics, charts, etc) , that shouldn't be impacted by who is the USER. )
 
AlexGurovich_0-1625953354448.png

 

 
 
1 ACCEPTED SOLUTION
daxer-almighty
Solution Sage
Solution Sage

Create a table (which will be hidden in the model) with pairs of (ProductID, Username). Username will be the user's email that they connect with, which you can return using a DAX function, probably Username() or something like this. This is the mapping you want to occur. Then connect Products via ProductID to this table with bi-dir filtering. Then put a slicer on the canvas as you would normally do using the column from Products. Then create a measure

 

[ProductIsOKToShow] =
var ProductIsOKToShow_ =
    NOT ISEMPTY(
        filter(
            ProductToUserBridgeTable,
            ProductToUserBridgeTable[UserName] = USERNAME()
        )
    )
return
    1 * ProductIsOKToShow_

 

and filter the slicer via Filter Pane where the condition [ProductIsOKToShow] is 1.

View solution in original post

2 REPLIES 2
AlexGurovich
Helper II
Helper II

@daxer-almighty Excellent, Kudos. Worked! Fantasic, and thanks for the good help.

daxer-almighty
Solution Sage
Solution Sage

Create a table (which will be hidden in the model) with pairs of (ProductID, Username). Username will be the user's email that they connect with, which you can return using a DAX function, probably Username() or something like this. This is the mapping you want to occur. Then connect Products via ProductID to this table with bi-dir filtering. Then put a slicer on the canvas as you would normally do using the column from Products. Then create a measure

 

[ProductIsOKToShow] =
var ProductIsOKToShow_ =
    NOT ISEMPTY(
        filter(
            ProductToUserBridgeTable,
            ProductToUserBridgeTable[UserName] = USERNAME()
        )
    )
return
    1 * ProductIsOKToShow_

 

and filter the slicer via Filter Pane where the condition [ProductIsOKToShow] is 1.

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.