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
Alpesh
Frequent Visitor

Filter on 2 Dim tables with OR condition

Hi

 

I have a fact table example below, but has another 60 columns and row count >2 million

 

Case IDShop IDProduct IDChannel ID 
abc126862101115600083735727676823 

 

These then have Dim tables, which have a hierarchy and has a relationship on the ID (One to Many)

 

e.g., Product Dim table (the other tables are the same in that they have a hierarchy) - has >50K records

 

 

Product L1Product L2Product L3Product L4Product L5Product ID
     560008373572

 

Shop Table -has > 900 records

Shop L1Shop L2Shop L3Shop ID
   10111

 

I need to be able to filter for an OR condition  e.g., Product L3 = "ABC" OR Shop L1 = "XYZ". How can i do this? I attempted to create a measure using crossjoin and filter however, when published the measure returns no results, so I assume this isn't the right solution. I could write an if statement in Power query, however, there are over 100 Product IDs as part of Product L3 = "ABC" so the formula would be massive and not very easy to adjust every time we've got a new product

1 ACCEPTED SOLUTION
mlsx4
Super User
Super User

Hi @Alpesh 

 

If tables are well connected, you should be able to do something similar to this using RELATED to take fields from other tables:

FILTER('FactTable',
		RELATED(Products[ProductID]) = "ABC" || 
		RELATED(Shops[ShopID]) = "XYZ")
	)

 

View solution in original post

2 REPLIES 2
Alpesh
Frequent Visitor

Brilliant,  had an error: function RELATED expects a fully qualified column reference as its argument, but then added the measure on the Fact table (instead of my measures table) and worked perfectly. Thank you!

mlsx4
Super User
Super User

Hi @Alpesh 

 

If tables are well connected, you should be able to do something similar to this using RELATED to take fields from other tables:

FILTER('FactTable',
		RELATED(Products[ProductID]) = "ABC" || 
		RELATED(Shops[ShopID]) = "XYZ")
	)

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.