cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Martine_
Regular Visitor

How to select value and show rows that contain value in one or multiple columns (in another table)

Hello all, 

 

I have been working on a report where I have muliple tables linked to each other, and currently have an issue where I can not look up rows based on one value that can be present in multiple columns. 

Example:
I have a table that shows data of a car dealership, where details, dates and times are logged. 
Now, in this table there are two columns with peoples names - in this example a created by and a updated by, (which can be different names).
There is also a table which shows names of these people, and some more personal details. 
My goal is to select a name in a table/list/slicer based on the People table and then every row in the Details table where this name is mentioned, (updated or created; does not matter) should show. 
When I try to create a relationship, I can only select 1 column, so for example only the Create column. 
 
Any ideas on how to achieve this?
Thanks very much in advance, 

 

Kind regards,

1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

@Martine_,

 

This solution uses a clone of the Details table. Filtering is achieved via DAX instead of a relationship.

 

Create calculated table (no relationships):

 

DetailsVisual = Details

 

Create measure:

 

Visual Filter = 
VAR vSelectedPeople =
    VALUES ( People[Name] )
VAR vFilterDetails =
    FILTER (
        DetailsVisual,
        DetailsVisual[Created By]
            IN TREATAS ( vSelectedPeople, Details[Created By] )
                || DetailsVisual[Updated By] IN TREATAS ( vSelectedPeople, Details[Updated By] )
    )
VAR vResult =
    IF ( COUNTROWS ( vFilterDetails ) <> BLANK (), 1 )
RETURN
    vResult

 

Create a slicer using the People table.

 

Create a table visual using fields from the DetailsVisual table, and add a visual filter using the measure above:

 

DataInsights_0-1653238806002.png

 

Result:

 

DataInsights_1-1653238819998.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

2 REPLIES 2
DataInsights
Super User
Super User

@Martine_,

 

This solution uses a clone of the Details table. Filtering is achieved via DAX instead of a relationship.

 

Create calculated table (no relationships):

 

DetailsVisual = Details

 

Create measure:

 

Visual Filter = 
VAR vSelectedPeople =
    VALUES ( People[Name] )
VAR vFilterDetails =
    FILTER (
        DetailsVisual,
        DetailsVisual[Created By]
            IN TREATAS ( vSelectedPeople, Details[Created By] )
                || DetailsVisual[Updated By] IN TREATAS ( vSelectedPeople, Details[Updated By] )
    )
VAR vResult =
    IF ( COUNTROWS ( vFilterDetails ) <> BLANK (), 1 )
RETURN
    vResult

 

Create a slicer using the People table.

 

Create a table visual using fields from the DetailsVisual table, and add a visual filter using the measure above:

 

DataInsights_0-1653238806002.png

 

Result:

 

DataInsights_1-1653238819998.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




This works perfectly, many thanks to you!

Helpful resources

Announcements
August 2022 update 768x460.jpg

Check it Out!

Click here to learn more about the August 2022 updates!

Power BI Dev Camp Session 25 with aka link 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, August 25 at 11a PDT for a great session with Ted Pattison!

August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors