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

Row level security

Hello Folks,

Thanks for the support for a beginer . 

Need the help to understand one scenario in RLS.

here, there is 3 users and need to implement RLS dynamically .

scenario is that there is one landing page and 3 other pages named dashbord1,2 and 3.

when person1 logins,he only able to see the KPI1,KPI2 and KPI3 and should have access to other pages .Like this,need to implement for multiple users .Please help me to find a way

 

Person1
 
KPI1KPI2KPI3
Dashboard1Dasbhoard2Dashboard3
   
Person2
 
KPI4KPI5 
Dashboard1Dasbhoard2Dashboard3
   
Person2
 
KPI6  
Dashboard1Dasbhoard2Dashboard3

 

regards

Ashik

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @ashikts ,

 

You can try to use a Card visual to work as a mask for some KPIs.

 

Method 1:

1. Create measures like so:

Make Transparent of KPI1 & KPI2 & KPI3 =
VAR CurrentUser =
    USERPRINCIPALNAME ()
RETURN
    IF ( CurrentUser = "Person1@domain.com", "#FFFFFF00", "White" )
Make Transparent of KPI4 & KPI5 = 
VAR CurrentUser =
    USERPRINCIPALNAME ()
RETURN
    IF ( CurrentUser = "Person2@domain.com", "#FFFFFF00" ,"White")
Make Transparent of KPI6 = 
VAR CurrentUser =
    USERPRINCIPALNAME ()
RETURN
    IF ( CurrentUser = "Person3@domain.com", "#FFFFFF00" ,"White")

 

2. Create card visuals.

cards.gif

 

3. Test.

test.gif

 

Method 2:

1. Create measures like so:

KPI1 & KPI4 & KPI6 =
SWITCH (
    USERPRINCIPALNAME (),
    "Person1@domain.com", "KPI1 Value",
    "Person2@domain.com", "KPI4 Value",
    "Person3@domain.com", "KPI6 Value"
)
KPI1 & KPI4 & KPI6 Title =
SWITCH (
    USERPRINCIPALNAME (),
    "Person1@domain.com", "KPI1 Title",
    "Person2@domain.com", "KPI4 Title",
    "Person3@domain.com", "KPI6 Title"
)
KPI2 & KPI5 =
SWITCH (
    USERPRINCIPALNAME (),
    "Person1@domain.com", "KPI2 Value",
    "Person2@domain.com", "KPI5 Value"
)
KPI2 & KPI5 Title =
SWITCH (
    USERPRINCIPALNAME (),
    "Person1@domain.com", "KPI2 Title",
    "Person2@domain.com", "KPI5 Title"
)
KPI3 =
SWITCH ( USERPRINCIPALNAME (), "Person1@domain.com", "KPI3 Value" )
KPI3 Title =
SWITCH ( USERPRINCIPALNAME (), "Person1@domain.com", "KPI3 Title" )
Make Transparent of KPI2 & KPI5 =
VAR CurrentUser =
    USERPRINCIPALNAME ()
RETURN
    IF (
        CurrentUser IN { "Person1@domain.com", "Person2@domain.com" },
        "#FFFFFF00",
        "White"
    )
Make Transparent of KPI3 =
VAR CurrentUser =
    USERPRINCIPALNAME ()
RETURN
    IF ( CurrentUser = "Person1@domain.com", "#FFFFFF00", "White" )

 

2. Create card visuals.

card2.gif

 

3. Test.

test2.gif

 

 

BTW, .pbix file attached.

 

 

Best regards

Icey

 

If this post helps, then consider Accepting it as the solution to help other members find it faster.

 

View solution in original post

2 REPLIES 2
Icey
Community Support
Community Support

Hi @ashikts ,

 

You can try to use a Card visual to work as a mask for some KPIs.

 

Method 1:

1. Create measures like so:

Make Transparent of KPI1 & KPI2 & KPI3 =
VAR CurrentUser =
    USERPRINCIPALNAME ()
RETURN
    IF ( CurrentUser = "Person1@domain.com", "#FFFFFF00", "White" )
Make Transparent of KPI4 & KPI5 = 
VAR CurrentUser =
    USERPRINCIPALNAME ()
RETURN
    IF ( CurrentUser = "Person2@domain.com", "#FFFFFF00" ,"White")
Make Transparent of KPI6 = 
VAR CurrentUser =
    USERPRINCIPALNAME ()
RETURN
    IF ( CurrentUser = "Person3@domain.com", "#FFFFFF00" ,"White")

 

2. Create card visuals.

cards.gif

 

3. Test.

test.gif

 

Method 2:

1. Create measures like so:

KPI1 & KPI4 & KPI6 =
SWITCH (
    USERPRINCIPALNAME (),
    "Person1@domain.com", "KPI1 Value",
    "Person2@domain.com", "KPI4 Value",
    "Person3@domain.com", "KPI6 Value"
)
KPI1 & KPI4 & KPI6 Title =
SWITCH (
    USERPRINCIPALNAME (),
    "Person1@domain.com", "KPI1 Title",
    "Person2@domain.com", "KPI4 Title",
    "Person3@domain.com", "KPI6 Title"
)
KPI2 & KPI5 =
SWITCH (
    USERPRINCIPALNAME (),
    "Person1@domain.com", "KPI2 Value",
    "Person2@domain.com", "KPI5 Value"
)
KPI2 & KPI5 Title =
SWITCH (
    USERPRINCIPALNAME (),
    "Person1@domain.com", "KPI2 Title",
    "Person2@domain.com", "KPI5 Title"
)
KPI3 =
SWITCH ( USERPRINCIPALNAME (), "Person1@domain.com", "KPI3 Value" )
KPI3 Title =
SWITCH ( USERPRINCIPALNAME (), "Person1@domain.com", "KPI3 Title" )
Make Transparent of KPI2 & KPI5 =
VAR CurrentUser =
    USERPRINCIPALNAME ()
RETURN
    IF (
        CurrentUser IN { "Person1@domain.com", "Person2@domain.com" },
        "#FFFFFF00",
        "White"
    )
Make Transparent of KPI3 =
VAR CurrentUser =
    USERPRINCIPALNAME ()
RETURN
    IF ( CurrentUser = "Person1@domain.com", "#FFFFFF00", "White" )

 

2. Create card visuals.

card2.gif

 

3. Test.

test2.gif

 

 

BTW, .pbix file attached.

 

 

Best regards

Icey

 

If this post helps, then consider Accepting it as the solution to help other members find it faster.

 

amitchandak
Super User
Super User

@ashikts , RLS can filter data, but can hide measure. But that possible using external tools

https://powerbi.microsoft.com/en-us/blog/power-bi-desktop-august-2020-feature-summary/#_Perspectives

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.