Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago

Search String for Multiple Keyword...

Hi all!!

 

I am new in PBI and I have some question about a search function. I hope someone could help me.

 

I have a column with Keywords and I use them as a filter slicer

 

 I want to select one or more, maybe all the Keywords in the slicer and I want to filter this table, for MAT_DESCRIPTION

For example, if I select in the  filter “TEST”;  I expect to see the rows with this description  test in the rows, and if I select “te” I expect to see the rows with this expression.

 

I created a Measure row in the table and I used this DAX function that I found the community

SearchFil = IF(SEARCH(SELECTEDVALUE('keys'[Column1]), MAX(‘Mytable’'[MAT_DESCRIPTION]),, BLANK())  =1, MAX ('Mytable'[MAT_DESCRIPTION]), BLANK())

 

When I select  “te”;  I want to see the first 6 rows and only see from the second to 6

 

When I select “TEST”; I see the corrects rows

When I select “TEST and “te” I see all the rows, included some of don’t need to view; the last 3 rows.

 

I am doing something wrong, but I cant find what is.

I appreciate your help for this. Thanks a lot.

 

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Anonymous,

    Please use DAX below, then set value of chkmeasure in visual level filter to 1.

    chkmeasure = IF(
          SUMX(Keys,
               FIND(
                    UPPER(Keys[Column1]),
                    UPPER(MAX(Mytable[MAT_DESCRIPTION]))
                    ,,0
                   )
              ) > 0,
          1,
          0
         )




    More details in this PBIX file.

    Regards,
    Lydia

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks very much for your help!

       

      I only have a doubt, when i select the option select all, dont send me results.

       

      Thanks.

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Anonymous,

        I am afraid that Select all option will not work in this case. I would recommend you disable select all option as it has same effect as that there is no selection in the slicer.

        Regards,
        Lydia

    • gco's avatar
      gco
      Resolver II

      Thanks Anonymous , your measure helped me with one of my reports.