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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Longhorns2013
Regular Visitor

Lookup or Search Multi-Select Between Tables

Hi All,

 

I have been stuck on this for over a week now and could really use some help:

 

I have one data table that contains the following information:

 

Project IDWorkstream IDValue
59 2
98 6
1 9
15596
17161
1001 9

 

In another Master Project/Workstream table, I have the following values:

Project IDWorkstream ID
594
595
596
987
988
989
1532
1559
1716
1720
1001254

 

I am unable to do a proper join because some users are entering their values without an appropriate workstream so I am trying to search if the values (could be multi-select) are contained in values table and if so, provide me the sum of their values. For example, if I select 1 and 98 from the master list, I would like to see a value of 22.

 

I have tried the following calculation but it keeps pulling in all of the numbers if I select 1 and 98 for example rather than just the two I selected. It does work for single select but the users are requesting the ability to select multiple:

Filter =
VAR searchproject =
    SEARCH (
        SELECTEDVALUE ( Master[Project ID] ),
        SELECTEDVALUE ( Values[Project ID] ),
        ,
        BLANK ()
    )



VAR searchworkstream =
    If(EXACT(
        SELECTEDVALUE ( Master[Workstream ID] ),
        SELECTEDVALUE ( Values[Workstream ID] )
    )=True,1,0)

RETURN
If(HASONEVALUE(Master[Workstream ID]) && searchworkstream>0"Found",
If(NOT HASONEVALUE(Master[Project ID]) && searchproject>0,"Found"))

Then my values calculation is 
CALCULATE(SUM(Value),FILTER(Values,[Filter]="Found"))

Is there any way to do this but include a multiple selection from the Master Project ID Dropdown? Any help as soon as possible is very, very much appreciated.
1 ACCEPTED SOLUTION
sturlaws
Resident Rockstar
Resident Rockstar

Hi, @Longhorns2013,

 

If you drop the relationship between your two tables, and write your measure like this:

Measure =
VAR _master =
    CALCULATETABLE ( VALUES ( Master[Project ID] ) )
RETURN
    SUMX (
        CALCULATETABLE (
            Project,
            FILTER (
                Project,
                CONTAINS ( _master, Master[Project ID], Project[Project ID] )
            )
        ),
        Project[Value]
    )

 

sturlaws_0-1671145211134.png

 

Cheers,
Sturla

If this post helps, then please consider Accepting it as the solution. Kudos are nice too.

 

View solution in original post

5 REPLIES 5
sturlaws
Resident Rockstar
Resident Rockstar

Hi, @Longhorns2013,

 

If you drop the relationship between your two tables, and write your measure like this:

Measure =
VAR _master =
    CALCULATETABLE ( VALUES ( Master[Project ID] ) )
RETURN
    SUMX (
        CALCULATETABLE (
            Project,
            FILTER (
                Project,
                CONTAINS ( _master, Master[Project ID], Project[Project ID] )
            )
        ),
        Project[Value]
    )

 

sturlaws_0-1671145211134.png

 

Cheers,
Sturla

If this post helps, then please consider Accepting it as the solution. Kudos are nice too.

 

Hi @sturlaws - This is great thank you! How would I add the workstream level search into that same calculation so it does a contains for exact project level IDs first and then exact workstream?

Depends on how you want to handle lines with missing workstream id

@sturlaws - if the Workstream ID is missing, it should just show the project ID associated to it. If it isnt then I would want the Workstream data.

have a look at the attached pbix-file below, I replaced null with Workflow ID is missing to improve usability

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors