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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
otets
Frequent Visitor

RLS and CROSSFILTER Error. Table has two join paths to table

Hi,

I try to use the CROSS FILTER function to avoid bi-directional relationships, and it works fine without RLS.

But when I try to use the same measure with RLS then, I receive the following error: "Join paths are expected to form a tree, but the table 'Revenue' has two join paths to table 'Org': 'Revenue'->'Org' and 'Revenue'->'Org'->'Metric'->'Org'"

I can reproduce it on the simple model and data.

Untitled - Power BI Desktop_221206175748.png

Measure =

    CALCULATE(
        SUM(Revenue[Revenue]),
        Metric[TypeID] = 1,
        CROSSFILTER(Metric[ProjectID], Org[ProjectID], Both)
    )

 

RLS (static for now) filters the SBU table.

Metric and Revenue - fact tables.

I have to propagate the filter by metric type from the Metric table to calculate the revenue (that is why I try to use CROSSFILTER and try to avoid both relationship directions)

 

If I remove "Metric[TypeID] = 1" from measure then it is work.

 

Could you please explain this error and help to resolve it?

2 REPLIES 2
sturlaws
Resident Rockstar
Resident Rockstar

Hi, @otets,

 

so something to do with how RLS is propagated from the "RLS"-table to the fact tables, I don't understand fully why it happens. 

But you have a couple of opportunities to rewrite it, like this:

 

Measure =
CALCULATE (
    SUM ( Revenue[Revenue] ),
    TREATAS (
        CALCULATETABLE ( VALUES ( Metric[ProjectID] ), Metric[TypeID] = 10 ),
        Org[ProjectID]
    )
)

 

 

Cheers,
Sturla

If this post helps, then please consider Accepting it as the solution. Kudos are nice too.

 

 

Hi, @sturlaws 

Thanks for your comment.
It works fine with RLS but not without it. It is a bit confusing for me.

The result without RLS
1.png
The measure RevenueByMetricType_1 with TREATAS solution
The measure RevenueByMetricType I have written recently. Here is the code

RevenueByMetricType = 
    CALCULATE(
        SUM(Revenue[Revenue]),
        SUMMARIZE(
            CALCULATETABLE(Metric, KEEPFILTERS(Metric[TypeID] = 1)),
            Org[ProjectID]
        )
    )


When I view it with RLS, the result is
2.png

I still don't understand this mystery with RLS and CROSSFILTER.

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.