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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Filter Data based on values starting with certain string

Hi! I want to ask if there is a way for me to filter the table below using DAX based on the Client IP address like the SQL query below:

 

select * from table 

where Client IP like '%127%';

 

 

TechNewbie1_0-1597924381215.png

 

Thank you!

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable
5 REPLIES 5
Anonymous
Not applicable

amitchandak
Super User
Super User

@Anonymous , add a measure like this with other not summarized data

calculate(countrows(Table),containsstring(Table[Client IP],"127"))

 

https://docs.microsoft.com/en-us/dax/containsstring-function-dax

 

other option

https://docs.microsoft.com/en-us/dax/search-function-dax

https://docs.microsoft.com/en-us/dax/find-function-dax

Anonymous
Not applicable

Thanks, @amitchandak! Is there a way to just filter it? So it will still return other columns like email, browser, etc.

 

I tried adding a filter command but this error message showed:

"The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value."

 

Thank you!!

Greg_Deckler
Super User
Super User

@Anonymous - You can, you would use SEARCH or FIND

 

You might want to create a "selector" like IF(SEARCH(...),1,0)

 

https://community.powerbi.com/t5/Quick-Measures-Gallery/The-Complex-Selector/m-p/1116633#M534


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Hi @Greg_Deckler - Thanks! I shall try this solution too.

I just wanted to filter those %% items and reflect the columns to my table.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors