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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
arawo
Regular Visitor

Text slicer: pasting multiple values

Hello, 
In my current report I have a list of products that contains several thousand entries. There is also a column with the name of the articles next to the article number. Sometimes I need to search for specific articles by description. The text slicer allows me to enable the function of entering several values, but I have to do it on the principle "first value" -> add, "second value" -> add.
I would like to be able to paste a list in the text slicer in the form of e.g. blue, red, black, yellow and the text slicer would separate the values ​​and search for all articles containing the entered phrase. So I created a text slicer and a list slicer and added a new measure:

ArtFiltr = 
VAR EnterValue = SELECTEDVALUE(InputsValues[Search])
VAR TheList = SUBSTITUTE(EnterValue, ";", "|")
RETURN
IF (
    CONTAINSSTRING( "|" & TheList & "|", "|" & SELECTEDVALUE(artlist[articledsc]) & "|" ),
    1,
    0
)

Then I added the articledsc to the lists slicer and the articledsc to text slicer and I also added my measure is 1 to the text slicer. 
Unfortunately, my solution didn't work. So I would like to ask if it is possible to do such a search in text slicer?

2 REPLIES 2
Elena_Kalina
Solution Supplier
Solution Supplier

Hi @arawo 

Your Current Solution Isn't Working because the SELECTEDVALUE function only works with single selections - it won't handle multiple values in a text slicer, the substitution of semicolons to pipes isn't being applied to the actual search logic and the CONTAINSSTRING logic is reversed (you're checking if the article is in the search string, rather than if any search term is in the article)

Please try the following
ArtFilter = 
VAR SearchTerms = SELECTEDVALUE(InputsValues[Search], "")  // Get the search text
VAR TermsList = 
    TRIM(
        SUBSTITUTE(
            SUBSTITUTE(
                SUBSTITUTE(SearchTerms, ",", "|"),
                ";", "|"
            ),
            " ", "|"
        )
    )  // Replace common delimiters with pipes
VAR TermsArray = 
    IF(
        TermsList = "",
        {""},
        PATHITEMALL(TermsList)
    )  // Split into array
VAR CurrentArticle = SELECTEDVALUE(artlist[articledsc], "")
RETURN
    IF(
        SearchTerms = "",  // If no search term, include all
        1,
        COUNTROWS(
            FILTER(
                TermsArray,
                CONTAINSSTRING(CurrentArticle, [Value])
            )
        ) > 0  // Return 1 if any search term is found in article
    )
DataNinja777
Super User
Super User

Hi @arawo ,

 

While the standard Power BI text slicer doesn't natively allow you to filter by pasting a delimited list of values, you can achieve this powerful functionality through several effective methods. This overcomes the time-consuming process of adding filter values one by one, which is especially cumbersome for reports with thousands of entries. Solutions now exist, including a new preview feature, specialized custom visuals, and refined DAX measures, to enable filtering by a pasted list of article descriptions.

 

A recent Power BI update introduced a preview feature that directly supports pasting multiple values into slicers. To use this, you must first enable the "New list and button slicers" option in File > Options and settings > Options > Preview features. After restarting Power BI, you can copy a single column of values from your source (without a header) and paste it directly into the new list or button slicer, which will automatically filter the report based on your pasted list.

 

Another excellent approach is to use a custom visual from the AppSource marketplace called "Filter by List." After importing this visual into your report, you can add the data field you want to filter, such as artlist[articledsc], to its "Values" well. The visual will then display a text box where you can paste a list of values like "blue, red, black, yellow," and it will filter your report accordingly, providing a dedicated and user-friendly interface for this specific task.

 

For those who prefer a DAX-based solution, you can create a measure to handle the filtering logic. Your original DAX measure was a good attempt but contained a logical flaw in how it checked for the values. A more effective approach is to check if the concatenated list of search terms contains the current article description. Here is a refined DAX measure that correctly implements this logic:

ArtFiltr = 
VAR EnteredValues = SELECTEDVALUE(InputsValues[Search])
VAR PreparedList = "|" & SUBSTITUTE(EnteredValues, ";", "|") & "|"
VAR CurrentArticle = "|" & SELECTEDVALUE(artlist[articledsc]) & "|"
RETURN
IF(
    CONTAINSSTRING(PreparedList, CurrentArticle),
    1,
    0
)

This measure works by first taking the semi-colon delimited string from a separate input table. It then formats this string by enclosing it and replacing the delimiters with pipe symbols (|) to ensure exact word matches (e.g., "|blue|red|black|"). It similarly wraps the current article description from your list in pipe symbols. The CONTAINSSTRING function then correctly checks if the formatted list of desired articles contains the current article being evaluated. To implement this, you create a disconnected table for the text input, add the ArtFiltr measure, and then apply a filter to your visual where the measure's value is 1.

 

Best regards,

Helpful resources

Announcements
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 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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