Forum Discussion
RLS and USERELATIONSHIP problem
- 1 year ago
Hi ju97,
Thank you for bringing this issue to our attention. We understand that the error related to the UseRelationship() and CrossFilter() functions has recently impacted your report, despite it functioning well previously.
As this is a known issue that is currently being addressed, we are unable to keep this thread open indefinitely.For official updates, you can check for more information through the provided link : Known issue - Reports that use functions with RLS don't work - Microsoft Fabric | Microsoft Learn
In the meantime, if you continue to experience difficulties, we kindly encourage you to create a new thread. This will allow us to assist you more effectively.
Thank you for your understanding, and please know that we are here to help!
Best regards,
Atheeq.
Guys, I’ve got the solution for this! I built a data lake using Microsoft Fabric at the company where I work, and I ran into the exact same issue you’re facing (even though this problem didn’t happen before). Here’s the solution:
I imagine some of you are assuming that you can’t use USERELATIONSHIP with RLS, but that’s not true. You actually can. So then, why is this error happening? Well, you need to take a look at the relationships between your tables. Let me show you my example:
Whenever there is an inactive relationship in a table that receives RLS, you CANNOT have a filter going in that direction. In the example below, in the image on the left, the table tb_vagas_gupy is filtering tb_calendario, which in turn is filtering tb_colaboradores, with one active relationship and another inactive one. What happens here is that the filter is trying to go through the inactive relationship as well, and RLS does not allow this, which is why you get the error.
In the image on the right, the relationship goes from tb_calendario filtering tb_vagas_gupy. Now it works, because tb_vagas_gupy is no longer indirectly filtering tb_colaboradores. But you may be wondering: “Wait, isn’t tb_calendario also filtering tb_colaboradores? Shouldn’t the same error happen?” The answer is NO. That’s because tb_calendario is derived from tb_colaboradores, so every record that exists in tb_calendario also exists in tb_colaboradores. Therefore, no actual filtering is being done since both tables contain the same data. That’s not the case for tb_vagas_gupy. This last table does not contain all the records from tb_colaboradores, which is why it was applying an active filter.
If you’d like more details, here’s a video in English from an Italian guy who explains this really well:
https://www.youtube.com/watch?v=sC9XT8tdAs4&ab_channel=SQLBI