Filter table based on a filtered table

I have a product/customer matrix that shows what products a customer has - I can filter that by product to give me a list of customers.
I have a table of contacts that I want to filter based on the customers that appear in the table above and the contact type filter

At the moment both tables filter but not unless I select a customer in the product/customer table. I want the contact table to filter based on the filters that have been applied to the customer / product table.
How can I do this please

PB Test Model - Copy (2).pbix (194.8 KB)

The problem you have with this visual is that the Opportunity table does not (and cannot easily) filter the Contact table.

You are using the Opportunity table to get the activity status for your ‘Contract Status’ visual - and that can filter the Account Name, but that table cannot filter the Contact Type.

However, this measure, added to the Contact visual table will do the trick.

Contact Type filter by Opportunity table = 
CALCULATE( 
    COUNTROWS( Contact ), 
        TREATAS( VALUES( Opportunity[AccountID] ), Contact[AccountID] ))

Thanks Heather. I’m not sure what that is doing / how it suppose to work
I’ve added that to the visual but when I change the contact type it doesn’t filter the contact table correctly
it returns all the contacts for the given type rather than just for the account in the customer/product table.?
It worked for the billing contact type but not the others

Okay - I had misunderstood what table you were attempting to filter. I saw this message:

image

and believed that you wanted to filter this table
image

so that is what is happening - the measure basically creates a temporary relationship between the Opportunity table (which is used in your slicer), and the Contact table (which is the table I thought you wanted to filter).

Please provide a demonstration of what results you expect (even in Excel will be helpful). I’m offline for the rest of the evening, but will check in on this in the morning (Central Time Zone)

Hi Heather

It is that table that I want to filter but it isn’t filtering by adding that measure

This is the result I’m getting
image

This is what I would like: ie the Active Key contacts for Account Name 1 (as filtered in the customer/product table
image

If I change the Contact Type slicer the Contact table would update with OPS Contacts for Account Name 1 etc

I’ve tried changing the relationship to the Quote but that doesn’t work either :slightly_frowning_face:

Is what I’m trying to do possible?

Hello @AliB

You are looking to filter account and contact based on products whereas there is no relationship b/w them.

Correct me if I am missing any point to create relationship to make it work.

Regards
Kumail Raza

Yes. I want to get contacts for a given product

Hello @AliB

In the dataset, contact and opportunity status are giving different values for the same account and that is some thing that you may need to consider.

I have updated the model and table to your requirements and hope this helps.

Regards
Kumail Raza
PB Test Model - Copy (2).pbix (219.0 KB)

Thanks Kumail much appreciated.
It’s not quite working on the Contact Type filter how I would expect.

If I leave the filter off contact type and just filter on the Product - both tables show the correct detail. ie all contacts for the customers in the Customer /Product Table
image

However, if I then set a filter on the contact type it also changes the customers that appear in the product/customer table
image

I would expect to see the following in the customer / product table regardless of the filter applied to contact type.
image

Is that possible?

Hello @AliB

The model is updated with the new relationship and the reference pbix file is attached.

I hope this answers your query.

Regards
Kumail Raza
PB Test Model - Copy (2).pbix (221.2 KB)

Hi @AliB, did the response provided by @Kumain help you solve your query? If not, how far did you get and what kind of help you need further? If yes, kindly mark as solution the answer that solved your query.

I hope that you are having a great experience using the Support Forum so far. Kindly take time to answer the Enterprise DNA Forum User Experience Survey, we hope you’ll give your insights on how we can further improve the Support forum. Thanks!

Thanks Kumail - that’s great!

I have a question about the relationships - I notice that you have removed the following relationships:
account - opportunity
contact type - contact
account - contact

These are used in other visuals in my production model - should I set them to inactive relationships and try and change all my other measures or would you suggest I have a completely separate model specifically for this problem?
I was trying to go for the Golden Dataset

Hello @AliB
Great to hear that I was able to solve your custom filter requirements.

Since the requirements were very specific, you can keep it as a separate model specifically for the mentioned problem.

Regards
Kumail Raza

Hi Kumail
Thanks for all your help so far … contacts is now working (great) but that has made the product filter / contract status filter not work anymore.

It is returning customers that do not have an Active contract for a given product
PB Test Model -update.pbix (234.0 KB)
image

When in fact Account 1 only has 1 Active contract for 1 product
image

How can I get that back working?

Hello @AliB

As you stated earlier, your initial requirement
image
has already been satisfied.

May be you can create separate request for the new requirements so to keeps this simpler for tracking.

Best Regards,
Kumail Raza

Hi Kumail
I can create another ticket but I think its related to the relationships we now have. Originally the customer/product table was filtering correctly. Now we have made the changes it isn’t ?

Bumping this post for more visibility.

Hello @AliB

Can you refer to the source table that “When in fact Account 1 only has 1 Active contract for 1 product”

Currently it shows Account 1 has 2 active contracts.


This is what is reflected in the visuals.

Regards
Kumail Raza