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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
adityavighne
Continued Contributor
Continued Contributor

Search and map values if contains from another table

Hi I need help regarding

 

I have

 

table 1

 

CategoryType

Category 1

Type1
Category 2

Type2

Category 3

Type3

 

table 2

CountryType 
USAType 1, Type 3
JapanType 2
IndiaType 2, Type 1, Type 3

 

now I want to filter table 2 based on table 1 category. if type contain in table 2 and show countries as output

 

if I filter Category 1 then output will be
USA

India

 

Thanks.

1 ACCEPTED SOLUTION
bhanu_gautam
Super User
Super User

@adityavighne 

Load the Data: Load both Table 1 and Table 2 into Power BI.

 

Ensure there is a relationship between the two tables based on the Type column. If the Type column in Table 2 contains multiple types separated by commas, you will need to split these into separate rows.

 

Split the Type Column in Table 2:

Go to the Power Query Editor.
Select the Type column in Table 2.
Use the "Split Column" feature to split by delimiter (comma in this case).
This will create multiple columns for each type. You can then unpivot these columns to create a row for each type.


Unpivot the Split Columns:

Select the newly created columns from the split operation.
Use the "Unpivot Columns" feature to transform these columns into rows.


Create a Filter:

Create a slicer visual in Power BI and use the Category column from Table 1.
This slicer will allow you to filter based on the selected category.

 

Create a measure or calculated column to filter Table 2 based on the selected category from Table 1.

DAX
SelectedCountries =
VAR SelectedCategory = SELECTEDVALUE('Table 1'[Category])
VAR SelectedType = CALCULATE(VALUES('Table 1'[Type]), 'Table 1'[Category] = SelectedCategory)
RETURN
CALCULATETABLE(
VALUES('Table 2'[Country]),
FILTER(
'Table 2',
CONTAINSSTRING('Table 2'[Type], SelectedType)
)
)

 




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

2 REPLIES 2
bhanu_gautam
Super User
Super User

@adityavighne 

Load the Data: Load both Table 1 and Table 2 into Power BI.

 

Ensure there is a relationship between the two tables based on the Type column. If the Type column in Table 2 contains multiple types separated by commas, you will need to split these into separate rows.

 

Split the Type Column in Table 2:

Go to the Power Query Editor.
Select the Type column in Table 2.
Use the "Split Column" feature to split by delimiter (comma in this case).
This will create multiple columns for each type. You can then unpivot these columns to create a row for each type.


Unpivot the Split Columns:

Select the newly created columns from the split operation.
Use the "Unpivot Columns" feature to transform these columns into rows.


Create a Filter:

Create a slicer visual in Power BI and use the Category column from Table 1.
This slicer will allow you to filter based on the selected category.

 

Create a measure or calculated column to filter Table 2 based on the selected category from Table 1.

DAX
SelectedCountries =
VAR SelectedCategory = SELECTEDVALUE('Table 1'[Category])
VAR SelectedType = CALCULATE(VALUES('Table 1'[Type]), 'Table 1'[Category] = SelectedCategory)
RETURN
CALCULATETABLE(
VALUES('Table 2'[Country]),
FILTER(
'Table 2',
CONTAINSSTRING('Table 2'[Type], SelectedType)
)
)

 




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Hi @adityavighne ,


If our response addressed by the community member for your query, please mark it as Accept Answer and click Yes if you found it helpful.

Should you have any further questions, feel free to reach out.
Thank you for being a part of the Microsoft Fabric Community Forum!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.