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

Change Data according to user

Hi,

i am providing BI reports to multiple customers with the same template and database,

right now duplicating the file for each customer and chaging the filter;

 

Is there a way to publish only 1 report which filter can change according to the user's login?

1 ACCEPTED SOLUTION
ribisht17
Super User
Super User

@Guneet_B21 

 

Not sure about your data set but you can make use of RLS, below you can see that how you can change the filter according to Login , for example Worker should only see Internal 

 

Consider an example using Power BI embedded, where the app passes the user's job role as the effective user name: It's either "Manager" or "Worker". Managers can see all rows, but workers can only see rows where the Type column value is "Internal".

The following rule expression is defined:

DAXCopy
 
IF(
    USERNAME() = "Worker",
    [Type] = "Internal",
    TRUE()
)

The problem with this rule expression is that all values, except "Worker", return all table rows. So, an accidental value, like "Wrker", unintentionally returns all table rows. Therefore, it's safer to write an expression that tests for each expected value. In the following improved rule expression, an unexpected value will result in the table returning no rows.

DAXCopy
 
IF(
    USERNAME() = "Worker",
    [Type] = "Internal",
    IF(
        USERNAME() = "Manager",
        TRUE(),
        FALSE()
    )
)

For more information check here >> Row-level security (RLS) guidance in Power BI Desktop - Power BI | Microsoft Docs

Regards,
Ritesh

 

 

View solution in original post

2 REPLIES 2
ribisht17
Super User
Super User

@Guneet_B21 

 

Not sure about your data set but you can make use of RLS, below you can see that how you can change the filter according to Login , for example Worker should only see Internal 

 

Consider an example using Power BI embedded, where the app passes the user's job role as the effective user name: It's either "Manager" or "Worker". Managers can see all rows, but workers can only see rows where the Type column value is "Internal".

The following rule expression is defined:

DAXCopy
 
IF(
    USERNAME() = "Worker",
    [Type] = "Internal",
    TRUE()
)

The problem with this rule expression is that all values, except "Worker", return all table rows. So, an accidental value, like "Wrker", unintentionally returns all table rows. Therefore, it's safer to write an expression that tests for each expected value. In the following improved rule expression, an unexpected value will result in the table returning no rows.

DAXCopy
 
IF(
    USERNAME() = "Worker",
    [Type] = "Internal",
    IF(
        USERNAME() = "Manager",
        TRUE(),
        FALSE()
    )
)

For more information check here >> Row-level security (RLS) guidance in Power BI Desktop - Power BI | Microsoft Docs

Regards,
Ritesh

 

 

Thank you,

really appreciate the solution

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.

Top Solution Authors
Top Kudoed Authors