Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors