Forum Discussion

maan98's avatar
maan98
New Member
1 year ago
Solved

Slicer search recommendation

I'm using a Slicer but the default setting is to search for data "Contains", is there a way to change this so that data is searched on "Starts With".

 

To be clear, I want the values recommended by the slicer to act in this way i.e. when I try seaching for a value.

  • Hi maan98 

    Thank you for reaching out to the Microsoft Fabric Community Forum.

    As pointed out by Deku , Power BI does not currently allow modification of the default slicer search behavior from "Contains" to "Starts With".This is a default and non-configurable behavior of the slicer search box and this behavior is not configurable through the standard Power BI interface. 

    As a workaound, please try the below solution:

    1. Create a table in Power BI with sample search input values.

        SearchText = DATATABLE("Search", STRING, {{"A"}, {"B"}, {"C"}, {"D"}})

    2. Add a slicer to a report using the SearchText[Search] column. Do not create any relationship between this table and main data model.

    3. Create a calculated column or measure on  main data table
         

     StartsWithMatch =

         VAR Input = SELECTEDVALUE('SearchText'[Search])

     RETURN

     IF(

        NOT(ISBLANK(Input)) &&

        LEFT(MainTable[TextColumn], LEN(Input)) = Input,1,0)

      

      4. Use this column as a filter (MainTable = 1) in your report.

    If my response has resolved your query, please mark it as the Accepted Solution to assist others. Additionally, a 'Kudos' would be appreciated if you found my response helpful.

    Thank You!

    Microsoft Fabric Community Support
     

5 Replies

  • Deku's avatar
    Deku
    Super User

    There is no option for that

     

    The only start with filtering functionality is in the filter pane but that will not help you narrow a search, will just return all the results that match the pattern

  • v-karpurapud's avatar
    v-karpurapud
    Community Support

    Hi maan98 

    Thank you for reaching out to the Microsoft Fabric Community Forum.

    As pointed out by Deku , Power BI does not currently allow modification of the default slicer search behavior from "Contains" to "Starts With".This is a default and non-configurable behavior of the slicer search box and this behavior is not configurable through the standard Power BI interface. 

    As a workaound, please try the below solution:

    1. Create a table in Power BI with sample search input values.

        SearchText = DATATABLE("Search", STRING, {{"A"}, {"B"}, {"C"}, {"D"}})

    2. Add a slicer to a report using the SearchText[Search] column. Do not create any relationship between this table and main data model.

    3. Create a calculated column or measure on  main data table
         

     StartsWithMatch =

         VAR Input = SELECTEDVALUE('SearchText'[Search])

     RETURN

     IF(

        NOT(ISBLANK(Input)) &&

        LEFT(MainTable[TextColumn], LEN(Input)) = Input,1,0)

      

      4. Use this column as a filter (MainTable = 1) in your report.

    If my response has resolved your query, please mark it as the Accepted Solution to assist others. Additionally, a 'Kudos' would be appreciated if you found my response helpful.

    Thank You!

    Microsoft Fabric Community Support
     

  • v-karpurapud's avatar
    v-karpurapud
    Community Support

    Hi maan98 

    May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

    Thank you.

  • v-karpurapud's avatar
    v-karpurapud
    Community Support

    Hi maan98 

    I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.

    Thank you.

  • v-karpurapud's avatar
    v-karpurapud
    Community Support

    Hi maan98 

    I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.

    Thank you.