Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Filter table based on column value starting with

So I have a table, with many columns, and one column which is "serial_number". Below my table, I want to have a button that when clicked (like an on/off switch) would show ONLY the table rows for which the string in the column "serial_number" starts with "XWW".

 

For example :

 

description     serial_number     id     
computerXWWRHG67133
computerXWWJKM88194
computerZHXWEK99211

 

When clicking on the button, it should filter out the last line, because the serial_number does NOT start with "XWW". 

Thanks

  • Hi Anonymous 

    This can be achieve using bookmarks. 

    You can create one bookmark by adding advance filter as starts with on serial_number column 

    and add one more bookmark without filter for "off" condition

     

    Now you add two buttons one for on and one for off. Put action type as bookmark and select respective bookmark for your button action

     

    Thanks

6 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      As a begginer, I would appreciate instructions on how you created that...

  • Samarth_18's avatar
    Samarth_18
    Community Champion

    Hi Anonymous 

    This can be achieve using bookmarks. 

    You can create one bookmark by adding advance filter as starts with on serial_number column 

    and add one more bookmark without filter for "off" condition

     

    Now you add two buttons one for on and one for off. Put action type as bookmark and select respective bookmark for your button action

     

    Thanks

    • Anonymous's avatar
      Anonymous
      Not applicable

      Power BI being the least intuitive app I have ever used in my life (along with other Microsoft products), I am still stuck as I don't know how to "create one bookmark by adding advance filter as starts with on serial_number column" - No idea how I should do that.

    • Anonymous's avatar
      Anonymous
      Not applicable

      OK I figured it out. Had to go to the View menu and select "Filters" and "Bookmarks" to display these 2 panes. Then with the table selected, expand the "serial_number" filter in the filters pane. Select "advanced filtering" then "starts with" then add "XWW", then switch to the bookmarks pane and hit "Add" which will create a bookmark with this filter "on". Do the same for the "off" state. Then add the related buttons by going to the "Insert" menu and select "Buttons" and "Blank" and create the button with whatever text and choose "Bookmark" as the button type in the "Actions" section. So intuitive.

      • Samarth_18's avatar
        Samarth_18
        Community Champion

        You got it absolutely correct. I was just taking screenshots for you only.😊