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 recommende...
  • v-karpurapud's avatar
    1 year ago

    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