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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Semipro211
Regular Visitor

Create a slicer that checks multiple columns for a value

Good Morning. I have done some seraching over the past few weeks and I have not been able to find anything that works, so apologies if this has been answered before. I am trying to find a way to filter a table using a slicer that looks at multiple column values concurrently. A brief scenario of the data is as follows:

 

Table 1:

Address Code
A12345
B34562
C65788

 

Table 2:

Item #Addr OneAddr TwoAddr Three
1245785421A12345B34562C65788
1234567890A99001A12345D65478
9875642135B34562E78541A12345
1125896325A99001E78541C65788
5419654782C12345D12345E12345

 

Given the above, what I am trying to achieve is a slicer so that if I pick an address code from Table 1, It will show the rows of all item numbers where the Address Code matches the value in any of the 3 Addr columns from Table 2. For example, Item # 1245785421 would show in the visual whether I selected A12345, B34562, or C65788 because all those values have a match in one of the 3 columns. However, Item # 5419654782 would only display when C12345 is selected in the slicer.

 

The only way I have been able to get this result is to create a derived table using CALCULATETABLE(SUMMARIZE(Table 2, Item #), FILTER(Table 2, CONTAINSSTRING(Addr One, "A12345") || CONTAINSSTRING(Addr Two, "A12345") || CONTAINSSTRING(Addr Three, "A12345").

 

I would have to repeat that process for every Address Code in Table 1 then relate each of them back to both Table 1 and Table 2. While this works, it feels inefficiant and the report performance is very slow due to the fact that the actual tables have many more columns and rows. Is there a way to achieve what I am trying to do without the use of the calculated tables? Oh, and the reason I used CONTAINSSTRING is because the real data has many more characters and will almost never be exactly the same as a listed Address Code.

 

Any help is very much appreciated!

1 ACCEPTED SOLUTION
Semipro211
Regular Visitor

Just wanted to let everyone know I was finally able to find a working solution for this. What was needed was I created a slicer table via

Slicer = 
DISTINCT(
    UNION(
          VALUES(Table 2[Addr One]),
          VALUES(Table 2[Addr Two]),
          VALUES(Table 2[Addr Three])
         )
        )

Then, I created a measure with the following:

SlicerMeasure = IF(
                        MIN(Table 2[Addr One]) IN VALUES(Slicer[Addr]) || MIN(Table 2[Addr Two]) IN VALUES(Slicer[Addr]) || MIN(Table 2[Addr One]) IN VALUES(Slicer[Addr]), 1, BLANK())

By adding that measure to my table visual, I am now able to use the single value to look at all 3 columns and return the correct result set. Thanks goes out to @v-jiascu-msft who posted this as an answer to another question here. The only tweak I had to make was I DID create a relationship from my Slicer table to my Table 1 because I did not want values that were not in Table 1 to display in the slicer options. In testing, this now works perfectly!

View solution in original post

1 REPLY 1
Semipro211
Regular Visitor

Just wanted to let everyone know I was finally able to find a working solution for this. What was needed was I created a slicer table via

Slicer = 
DISTINCT(
    UNION(
          VALUES(Table 2[Addr One]),
          VALUES(Table 2[Addr Two]),
          VALUES(Table 2[Addr Three])
         )
        )

Then, I created a measure with the following:

SlicerMeasure = IF(
                        MIN(Table 2[Addr One]) IN VALUES(Slicer[Addr]) || MIN(Table 2[Addr Two]) IN VALUES(Slicer[Addr]) || MIN(Table 2[Addr One]) IN VALUES(Slicer[Addr]), 1, BLANK())

By adding that measure to my table visual, I am now able to use the single value to look at all 3 columns and return the correct result set. Thanks goes out to @v-jiascu-msft who posted this as an answer to another question here. The only tweak I had to make was I DID create a relationship from my Slicer table to my Table 1 because I did not want values that were not in Table 1 to display in the slicer options. In testing, this now works perfectly!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors