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
felipemacgregor
New Member

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
felipemacgregor
New Member

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
felipemacgregor
New Member

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]
        )
    )

 

v-kongfanf-msft
Community Support
Community Support

Hi @felipemacgregor ,

 

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
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.