Forum Discussion
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 ID | Workstream ID | Value |
| 59 | 2 | |
| 98 | 6 | |
| 1 | 9 | |
| 1 | 559 | 6 |
| 1 | 716 | 1 |
| 1001 | 9 |
In another Master Project/Workstream table, I have the following values:
| Project ID | Workstream ID |
| 59 | 4 |
| 59 | 5 |
| 59 | 6 |
| 98 | 7 |
| 98 | 8 |
| 98 | 9 |
| 1 | 532 |
| 1 | 559 |
| 1 | 716 |
| 1 | 720 |
| 1001 | 254 |
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:
Then my values calculation is
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.
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] )Cheers,
Sturla
If this post helps, then please consider Accepting it as the solution. Kudos are nice too.
5 Replies
- sturlawsResident 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] )Cheers,
Sturla
If this post helps, then please consider Accepting it as the solution. Kudos are nice too.- Longhorns2013Regular Visitor
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?
- sturlawsResident Rockstar
Depends on how you want to handle lines with missing workstream id