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

Both direction filter messes up further 'logic relationship' with RLS

hi,

 

we hope you could help us. We search the forum & tried everything we thought of.

 

Problem

We expect the following result (see photo1), but once we activate the 'both direction' filter on a related table. It gives us another result.

 

Expected result:

the claim filters the amounts

This is the case, when we delete the 'both relationship' between contact & claim -> However we need the relationship 😉

2020-03-06_170247.png

 

However once we activate the both direction filter, as can be seen below. The result changes completely towards.

The claimId (of claim table), shows nothing...

2020-03-06_171145.png

 

The structure is as follows

user (many) -> (many) Contacts (many) <-> Claim (one) 

Claim (one) -> Amount( many)  

2020-03-06_165826.png2020-03-06_170404.png2020-03-06_1702253.png

 

Thanks for your help.

 

1 ACCEPTED SOLUTION
edhans
Super User
Super User

First of all ensure 100% that the field types are the same in Power Query. Second, I'd advise you read this article on many to many relationships. They can often cause unexpected results, and often a bridge table is the better alternative.

 

Your bi-directional relationships can also cause unexpected issues. I try to avoid those at all costs in the model, but then activation bidirectional filtering on a measure basis with the CROSSFILTER() modifier to CALCULATE(). For example, see the following pseudo-code:

Measure =
CALCULATE(
     SUM(SomeTable[ColumnX]),
     CROSSFILTER(SomeTable[ColumnY],DifferentTable[Column4],BOTH)
     )

That leaves the model alone, but for that measure only, it does a bi-directional crossfilter on the relationship between SomeTable[ColumnY] and DifferentTable[Column4]. The relationship has to exist in the model - and can be inactive, though if it is inactive, you also have to use the USERELATIONSHIP() modifier to turn it on or CROSSFILTER still won't work. CROSSFILTER doesn't create relationships, it modifies them.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Tibo_Belgium 

does the above reply helps. if you need more help make me @

 

Appreciate your Kudos.

edhans
Super User
Super User

First of all ensure 100% that the field types are the same in Power Query. Second, I'd advise you read this article on many to many relationships. They can often cause unexpected results, and often a bridge table is the better alternative.

 

Your bi-directional relationships can also cause unexpected issues. I try to avoid those at all costs in the model, but then activation bidirectional filtering on a measure basis with the CROSSFILTER() modifier to CALCULATE(). For example, see the following pseudo-code:

Measure =
CALCULATE(
     SUM(SomeTable[ColumnX]),
     CROSSFILTER(SomeTable[ColumnY],DifferentTable[Column4],BOTH)
     )

That leaves the model alone, but for that measure only, it does a bi-directional crossfilter on the relationship between SomeTable[ColumnY] and DifferentTable[Column4]. The relationship has to exist in the model - and can be inactive, though if it is inactive, you also have to use the USERELATIONSHIP() modifier to turn it on or CROSSFILTER still won't work. CROSSFILTER doesn't create relationships, it modifies them.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

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.