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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

RLS for 2 dimensions

The project is about moving between projects.

I have two RLS tables (RLS_origem and RLS_destino), one for the source project(RLS_origem) and the other for the target project(RLS_destino), where I have the user logins (column: email_longin) and the projects released for each one (rls_sk_projeto). In my fact table (fato), I have two columns, one for the source project (sol_origem_sk_prrojeto) and one for the target project (sol_destino_sk_prrojeto).
With this, I need to create an RLS where the project released to the user is present in the source project or target project column in my fact table.

 

felipemacgregor_0-1713219454209.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

The issue was resolved with the following solution:

 

SOLUTION: 

(
        [sol_origem.sk_projeto] IN SELECTCOLUMNS(
            FILTER(
                'RLS_origem',
                'RLS_origem' [email_login] = USERNAME()
            ),
            "Project",
            [rls_sk_projeto_orig]
        )
    ) || (
        [sol_destino.sk_projeto] IN SELECTCOLUMNS(
            FILTER(
                'RLS_destino',
                'RLS_destino' [email_login] = USERNAME()
            ),
            "Project",
            [rls_sk_projeto_dest]
        )
    )

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

The issue was resolved with the following solution:

 

SOLUTION: 

(
        [sol_origem.sk_projeto] IN SELECTCOLUMNS(
            FILTER(
                'RLS_origem',
                'RLS_origem' [email_login] = USERNAME()
            ),
            "Project",
            [rls_sk_projeto_orig]
        )
    ) || (
        [sol_destino.sk_projeto] IN SELECTCOLUMNS(
            FILTER(
                'RLS_destino',
                'RLS_destino' [email_login] = USERNAME()
            ),
            "Project",
            [rls_sk_projeto_dest]
        )
    )

 

Anonymous
Not applicable

Hi @Anonymous ,

 

The following recommendations are for reference:

  • Create RLS Tables: Make sure you have two RLS tables named RLS_origem and RLS_destino. These tables should contain user login information (email_login) and information about items posted by each user (rls_sk_projeto).
  • Create Relationships: Ensure that there are relationships between the RLS tables and the fact table (fato). These relationships should be based on the email_login column.
RLS_Permission =
VAR UserProjects =
    UNION (
        VALUES ( 'fato'[sol_origem_sk_prrojeto] ),
        VALUES ( 'fato'[sol_destino_sk_prrojeto] )
    )
RETURN
    IF (
        CONTAINS (
            UNION ( 'RLS_origem', 'RLS_destino' ),
            'RLS_origem'[email_login], USERNAME ()
        )
            && COUNTROWS (
                INTERSECT ( VALUES ( 'RLS_origem'[rls_sk_projeto] ), UserProjects )
            ) > 0,
        BLANK (),
        IF (
            CONTAINS (
                UNION ( 'RLS_origem', 'RLS_destino' ),
                'RLS_destino'[email_login], USERNAME ()
            )
                && COUNTROWS (
                    INTERSECT ( VALUES ( 'RLS_destino'[rls_sk_projeto] ), UserProjects )
                ) > 0,
            BLANK (),
            1
        )
    )

 

Best Regards,
Adamk Kong

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.