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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
SCBAT21
New Member

Filter values in one table based on selection in another table

Attempting to see if what I'm trying to do is possible using two simplified datasets. I have two tables as seen below, consumer profile and purchases. Consumer profile is essentially categorizations of the purchase history of IDs, and Purchases is the actual purchases for the IDs. What I need is for the selections I make in the consumer profile table to impact the purchase table. Specifically, based on the selections/slicers applied to the consumer profile table I want the purchase table to only display data for IDs that the selection is applicable to. 

 

SCBAT21_0-1706015605691.png

 

For instance, if I select 60% from the % vol column in the consumer profile table, I want to see only the servings in the purchase table that correspond with IDs that match with that selection as can be seen below:

SCBAT21_1-1706015759781.png

 

I will have many more columns in the consumer profile table but this is high level what I'm trying to accomplish. I've been playing around with DAX to try and solve this issue but haven't had any luck, it will generally only filter the IDs, not any of the other purchase data connected to the IDs. A current view of my data model below. Any help would be greatly appreciated!

 

SCBAT21_3-1706015908922.png

 

 

 

1 ACCEPTED SOLUTION
Bmejia
Super User
Super User

If you have a realations ship on ID on both tables you should be getting this when you use a slicer on 60%.

Bmejia_0-1706031740481.png

 

If you are looking to see what is on your second table only you need to create a different relationship  that is base on the ID and Brand or if you have another primary key that can have a unique releationship.

Create New Column to build a different relationship, you can do it either during data transformation or just a column.  It should look something like this. 

ID_Brand_key = 'Purchases'[ID]&"-"&'Purchases'[Brand] and  -- example ABC-Project A
ID_Brand_key = 'Consumer Profile'[ID]&"-"&'Consumer Profile'[Brand]
 
Then create the relationship using this new key on both tables, you will get this

Bmejia_1-1706032098823.png

 

View solution in original post

5 REPLIES 5
Bmejia
Super User
Super User

It should work as long as you only relationship to get to what you want is base on those two factors.  This will always  depends on what you are trying to accomplish.  Prefarably you always want to use key relationships that are build within the tables so you do not have to do this relationships manual.

The relationship is based on those factors, however it doesn't perform as I need it to based on the current key. For instance, you can see the example table below, ID ABC has purchased two products, Product A and Product B. When I selelct brand from the consumer profile table, I want it to show me all the purchases asscoiated with an ID that has purhased the brand selected. 

 

SCBAT21_0-1706830807078.png

As you can see, when I select Product B it filters to only Product B in the purchase table, however I want to see all the purchases asscoiated with the ID when they have purchased Product B. So for instance the Product A purchase asscoiated with ID ABC should appear as well when I select product B. 

 

SCBAT21_1-1706831038826.png

 

 

 

When you select the Brand Product B.  The filter is doing what it was intendent to do.  Select only Brand with Product B.   If you want to show all the products associated with ID ABC then you have to have a filter that selects the ID rather then the Brand.

Bmejia_0-1706887467624.png

 

Bmejia
Super User
Super User

If you have a realations ship on ID on both tables you should be getting this when you use a slicer on 60%.

Bmejia_0-1706031740481.png

 

If you are looking to see what is on your second table only you need to create a different relationship  that is base on the ID and Brand or if you have another primary key that can have a unique releationship.

Create New Column to build a different relationship, you can do it either during data transformation or just a column.  It should look something like this. 

ID_Brand_key = 'Purchases'[ID]&"-"&'Purchases'[Brand] and  -- example ABC-Project A
ID_Brand_key = 'Consumer Profile'[ID]&"-"&'Consumer Profile'[Brand]
 
Then create the relationship using this new key on both tables, you will get this

Bmejia_1-1706032098823.png

 

This worked! Thank you. For my knowledge, will the key still filter correctly even if I begin to apply slicers from additional columns in both tables? Or will I need to add that into the key? 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.