Forum Discussion

PiotrStawicki's avatar
PiotrStawicki
Frequent Visitor
4 years ago
Solved

Problem with 2 reports connected to common dataset with 2 RLS statements

Hi! I have a problem that seems to be easy, but already has taken me hours and I haven't find any solution also in the forum (there are similar issues described but I didn't find anything that w...
  • PiotrStawicki's avatar
    4 years ago

    Hi, I managed to find a solution:

     

    I created two additional, supportive "Contact" queries in the Query Editor - first has only the contact ID and username, second has ID, username and columns with 1st level manager username, 2nd level manager username etc.

    Then I added a flague, on the first supportive query set to 1, on the second - to 0.

    I appended the 2nd query to the first, loaded to the datamodel and created a many-to-many connection between the supportive Contact query and the main one (where supportive table filters the main table).

     

    DAX in RLS statement configures the access to all the records (in the supportive query) where any of the columns contain user's username.

     

    Then in the personal report, the flague is set to 1 (in the whole report), so only the standard [Username] column contains any data. In the team report, the flague is set to 0 and supportive Contact table contains both standard username and usernames of managers as well.

     

    Maybe there is easier solution, but this works fine for me, so topic can be closed 🙂

    BR, Piotr