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
Tierne5137
New Member

Filtering Table Based on Slicer Value (Table 1) to a Table Row Text Value Containing Slicer Value

I am trying to use Slicer (Table 1 [Branck Prefix]) to Filter (Table 2 [BOL No], where the row value contains the text value of (Table 1 [Branck Prefix]).

 

Table 1 = Slicer

BranchBranch Prefix
Aiken Roll ShopsAKE
AppletonVAMT
Automation LansdaleLANS
Automation NorcrossNRC
Automation TorontoTRNT
BeloitBEL
BiddefordBDD
CharlotteCHAR
Clark's Summit Roll ShopsCLAR
Coldwater AppletonCWAP
Coldwater AtlantaCATL

 

Table 2 

Division - BranchBOL No
AIKEN ROLL SHOPS95083702
AIKEN ROLL SHOPS95092946
AIKEN ROLL SHOPSA106262F0
AIKEN ROLL SHOPSAKE2131400001
AIKEN ROLL SHOPSAKE2132600002
AIKEN ROLL SHOPSAKE2133500001
AIKEN ROLL SHOPSAKE2133600001
AIKEN ROLL SHOPSBOL0198269
AIKEN ROLL SHOPSBOL0204821
AIKEN ROLL SHOPSBOL2819
AIKEN ROLL SHOPSBOL6706
ATLANTA-COLDWATERBCNC12271300
ATLANTA-COLDWATERCATL2221500001
ATLANTA-COLDWATERCATL2221500002
ATLANTA-COLDWATERCATL2221500003
ATLANTA-COLDWATERCATL2221600002
ATLANTA-COLDWATERVAMT2233400006
ATLANTA-COLDWATERVAMT2234600010
ATLANTA-COLDWATERVarious
2 ACCEPTED SOLUTIONS

A great way is to separate TEXT from Numbers as a calculated column and then make a relationship with it to Table1 Column.

 

But anothor easy way is as below:

 

Write Below Measure:

 

CHECKBranchPrefix =
SUMX (
    CROSSJOIN ( 'Table 1', 'Table 2' ),
    IF (
        CONTAINSSTRING ( 'Table 2'[BOL NO], 'Table 1'[Branch Prefix] ),
        1,
        BLANK ()
    )
)

Then with the attached image (setting an advanced filter for the measure), you can achieve your desired result.

 

If it solves your problem, then please consider Accepting it as the solution
Regards,
LoranBOL.JPG

 

View solution in original post

Hi @Tierne5137 ,
Hope you are doing well.
I have implemented the same scenario like you and got expected output as you want.

So here are the steps which you have to perform in order to solve your problem.
I have plotted a slicer and in that slicer i have plotted Branch Prefix from Table 1.
I have also plotted the two tables as it is with all the data as you can see in the below image.

KeyurPatel14_0-1679033377117.png

I have also created one measure using CONTAINSSTRING DAX Function as you can see in the below image.

KeyurPatel14_1-1679033432072.png

Then I selected the Table 2 and applied Visual level filter with the created measure M1 as per the below image.

KeyurPatel14_2-1679033517448.png

Now if you select any value in the slicer it will filter the data of Table 2 just like you want as you can see in the image.

KeyurPatel14_3-1679033647240.png

If there is no value in Table 2 like you select in the slicer then it will show no data as per the image. (NOTE: You can also return some value instead of no data)

KeyurPatel14_4-1679033707548.png


I hope this will solve your problem and still if you have any queries then please let me know.
If this solution helps you then please give it a kudos and mark it as a solution.

Thank you.

View solution in original post

5 REPLIES 5
Tierne5137
New Member

Hello Loran,

I think I confused the issue by showing the first columns in both tables. To simplify my issue see my revised tables. I am not sure if a slicer will be the correct way to do this. It may need a new calculated column to pull the first letters of the Table 2 rows which equals the values in Table 1 Branch Prefix values.

Table 1

Branch Prefix
AKE
VAMT
LANS
NRC
TRNT
BEL
BDD
CHAR
CLAR
CWAP
CATL

 

Table 2

BOL No
95083702
95092946
A106262F0
AKE2131400001
AKE2132600002
AKE2133500001
AKE2133600001
BOL0198269
BOL0204821
BOL2819
BOL6706
BCNC12271300
CATL2221500001
CATL2221500002
CATL2221500003
CATL2221600002
VAMT2233400006
VAMT2234600010

Hi @Tierne5137 ,
Hope you are doing well.
I have implemented the same scenario like you and got expected output as you want.

So here are the steps which you have to perform in order to solve your problem.
I have plotted a slicer and in that slicer i have plotted Branch Prefix from Table 1.
I have also plotted the two tables as it is with all the data as you can see in the below image.

KeyurPatel14_0-1679033377117.png

I have also created one measure using CONTAINSSTRING DAX Function as you can see in the below image.

KeyurPatel14_1-1679033432072.png

Then I selected the Table 2 and applied Visual level filter with the created measure M1 as per the below image.

KeyurPatel14_2-1679033517448.png

Now if you select any value in the slicer it will filter the data of Table 2 just like you want as you can see in the image.

KeyurPatel14_3-1679033647240.png

If there is no value in Table 2 like you select in the slicer then it will show no data as per the image. (NOTE: You can also return some value instead of no data)

KeyurPatel14_4-1679033707548.png


I hope this will solve your problem and still if you have any queries then please let me know.
If this solution helps you then please give it a kudos and mark it as a solution.

Thank you.

MohammadLoran25
Solution Sage
Solution Sage

Hi @Tierne5137 

As the Branch column of Tables1 is not exactly same as the Division - Branch Column of Table2,

you have to create a new column in Table2 and define related Prefixes. For example for "ATLANTA-COLDWATER" in your table2, the prefix column would be CATL. 

Then you need to create a Many-To-One Relationship From Table2 Prefix column to Branch Prefix column of Table 1.

 

Then it works as you want.

I have to mention that as you have limited Prefixes in Table1, so you can handle it in power Query by adding a new column:

Go to the Power Query --> Add Column Tab --> Column from Examples -->From Selection (which here would be based on Division-Branch Column of Table2)

 

If it solves your problem, then please consider Accepting it as the solution
Regards,
Loran

Hi Loran

I do understand your reply but it does not fit what I am looking to do. Please consider that I have the only 1 column in Table 1 [Branch Prefix] and one column in Table 2 [BOL No]. I want to filter the BOL No rows based on the Text that is contained from the Table 1 [Branch Prefix]. I am not sure but can a new column be added and DAX formula used to return a True or False, based on the Table 1 [Branch Prefix] text?

 

Table 1

Branch Prefix
AKE
VAMT
LANS
NRC
TRNT
BEL
BDD
CHAR
CLAR
CWAP
CATL

 

Table 2

BOL No
95083702
95092946
A106262F0
AKE2131400001
AKE2132600002
AKE2133500001
AKE2133600001
BOL0198269
BOL0204821
BOL2819
BOL6706
BCNC12271300
CATL2221500001
CATL2221500002
CATL2221500003
CATL2221600002
VAMT2233400006
VAMT2234600010

 

A great way is to separate TEXT from Numbers as a calculated column and then make a relationship with it to Table1 Column.

 

But anothor easy way is as below:

 

Write Below Measure:

 

CHECKBranchPrefix =
SUMX (
    CROSSJOIN ( 'Table 1', 'Table 2' ),
    IF (
        CONTAINSSTRING ( 'Table 2'[BOL NO], 'Table 1'[Branch Prefix] ),
        1,
        BLANK ()
    )
)

Then with the attached image (setting an advanced filter for the measure), you can achieve your desired result.

 

If it solves your problem, then please consider Accepting it as the solution
Regards,
LoranBOL.JPG

 

Helpful resources

Announcements
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.

June 2025 community update carousel

Fabric Community Update - June 2025

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