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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
AndyU
New Member

Database relationships and filtering

Hello,

 

I have two tables with the that are linked in a relationship. Table A contains all the information I wish to present, and table B is just to check certain criteria for the same rows and to filter out unwanted ones from the data presented based on Table A. However, it seems like PowerBI is filtering out any rows that are non-existant in table B, not only the ones I have asked it to filter based on certain criteria. Example:

 

Table A:

Relationship ColumnData to be presented
133
245
3634
4623
5456
6458
7354

 

Table B:

Relationship ColumnFilter Criteria
1Red
2Blue
3Green
4Red
5Yellow

 

In this example, I wish to filter away Blue and Green, so that only data from Red and Yellow is presented. In addition, I would also like to present the data in rows 6 and 7 in table A, even though it is not present in table B, as I am only looking to filter away any Blues and Greens that are present in table B. Right now PowerBI seems to be filtering away 6 and 7 as well since it can't find them in table B.

 

Any help would be appreciated!

2 REPLIES 2
v-danhe-msft
Employee
Employee

Hi @AndyU,

Based on my test, you could refer to below formula:

Measure = CALCULATE(MAX('TableB'[Filter Criteria]),FILTER('TableB','TableB'[Filter Criteria]<>"Blue"&&'TableB'[Filter Criteria]<>"Green"))

And choose the 'Show items with no data':

1.PNG

 

You could also download the pbix file to have a view.

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Daniel,

 

Thanks for your suggestion. I tried playing around with it but I couldnt get it to do what I wanted. After some testing it seems like the issue is that in the real database (not the example I gave), table B has duplicates in the relationship column, which prevents a one to one cardinality. Once I deleted the duplicates, it seems to be working fine and is including all those entries in table A that do not exist in table B. However, this is not an optimal solution was I don't want to keep manually going through the duplicates and then deleting them or renaming. 

 

Is there a way to make this work with duplicates?

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.