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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Femm1234
Regular Visitor

How to apply a dynamic filter with specific filtering logic for wildcard search

Hello, 

 

I’m working on a Power BI visual where I need to filter data based on user input that follows a pattern with wildcard search. Essentially, I want the search function to allow for a dynamic filter where, if there is no * at the end, it should end with the value that was searched for. For example, if the user searches for 'text1*text2', the result should return all values that start with "text1" and that end with "text2". If user searches for 'text1*text2*', there is a * at the end, so the operator is 'contains'. Same for searches with 'text1*'.

Here’s my current setup:

  • I’m using the 'contains' operator for filtering, as 'endswith' is not available in the advanced filter API.
  • My current logic works for:
    • text*: It returns all values that contain the specified prefix before the wildcard with operator 'contains'. 
    • text: It returns an exact match using the 'is' operator.

However, for searches like text1*text2, I need the filter to behave as if it uses a 'endswith' operator for the part after the *, when there is no * at the end.

 

Any help is appreciated. Thanks in advance!

1 REPLY 1
lbendlin
Super User
Super User

use SEARCH  (or FIND) to figure out if the search term is at the end of the string or not.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors