Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

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.

 

 

  • Anonymous's avatar
    Anonymous
    2 years ago

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

     

2 Replies

  • Anonymous's avatar
    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.

  • Anonymous's avatar
    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]
            )
        )