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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
fabiomanniti
Helper III
Helper III

SQL Like equivalent filter

If I do my query on the DB I have something like this:

SELECT *
FROM fact.rent f
LEFT JOIN dim.rent d ON f.id_tk = d._tk
LEFT JOIN dim.users du ON du._tk = d.user_id_tk
WHERE 1=1
AND f.d_date_tk = get_last_msnap_date()
AND du.promoter_path LIKE '%9d732d5c-65d9-4937-9224-01c17f9e7d28%'
;

that means that it gets all entries which contains my string into the "promoter_path" field.

I want to do something similar on Power BI.

I would like a filter with all user names, and when I select a user, it should get the corresponding Id and match with all rows which contains that id within the field "promoter_path".

 

So, in other words, is it possible to create a filter on Power BI which is not "equal to" but "Like to"?

 

4 REPLIES 4
Anonymous
Not applicable

Hi @fabiomanniti ,

 

You could use the CONTAINSSTRING function to filter the text within "9d732d5c-65d9-4937-9224-01c17f9e7d28".

Measure = IF(CONTAINSSTRING(MAX('Table'[promoter_path]),"9d732d5c-65d9-4937-9224-01c17f9e7d28"),1)

vstephenmsft_0-1653371235727.png

The screenshot above is the result returned by the measure, you can use the measure as a visual-level filter instead of putting the measure into the visual.

Drag the measure into the visual-level filters, set show items when the value is 1.

vstephenmsft_1-1653371379227.png

 

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

The problem with this method is this works as long as the "id" I want to filter is always the same.

So I could manually insert the id into the formula.

 

What I want is a dynamical table so that I can filter a new user, with its own id and the table content changes.

 

So let's say that I have two tables:

User: user_id

Sales: sale_id, user_id

So I can create a relationship between user and sales through user_id; now, anytime I select a user, I can see all their sales.

 

I want something similar but, instead of a direct relationship like this I want:

user: user_id

sales: sale_id, something_with_user_id_within_it

 

The problem is if I create a table, the tables in Power BI are always static.

 

tackytechtom
Super User
Super User

Hi @fabiomanniti ,

 

I am sure you can find you are looking for in this blog post here:

 

From SQL to DAX: String Comparison - SQLBI

 

Let me know if this helps 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

@tackytechtom 

Actually, not really.

I have tried something like this:

I created a new table then 

 

Table =
VAR include_text = SELECTEDVALUE(users[id])
return
CALCULATETABLE(
users,
CONTAINSSTRING(users[path], include_text)
)

 

 

But it doesn't seem to work.

I don't see any changing by changing the selection

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.