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
vitexo87
Post Prodigy
Post Prodigy

LIKE function in a measure

How to use a function that does the same thing as, for example, I want to do a calculation where I want only one group of information in a given field to be considered:
Global Efficiency =
CALCULATE (
'IndicatorValue' [Value AVG];
TREATS ({("Global (%)")}; 'Indicator' [Description]); Equipment [DescriptionL1] = "L1_ *")

1 ACCEPTED SOLUTION
v-ljerr-msft
Employee
Employee

Hi @vitexo87,

 

The LIKE operators in SQL has a similar correspondent function in DAX: the SEARCH function has a slightly different semantic because it returns the position found instead of a True/False value.

 

For example, consider the following condition in SQL:

Name LIKE '%SQLBI%Methodology%at%work%'

The correspondent syntax in DAX is:

SEARCH( "SQLBI*Methodology*at*work", Table[Name], 1, 0 ) > 0

There are more similar examples here:

https://www.sqlbi.com/articles/from-sql-to-dax-string-comparison/

 

Regards

View solution in original post

2 REPLIES 2
v-ljerr-msft
Employee
Employee

Hi @vitexo87,

 

The LIKE operators in SQL has a similar correspondent function in DAX: the SEARCH function has a slightly different semantic because it returns the position found instead of a True/False value.

 

For example, consider the following condition in SQL:

Name LIKE '%SQLBI%Methodology%at%work%'

The correspondent syntax in DAX is:

SEARCH( "SQLBI*Methodology*at*work", Table[Name], 1, 0 ) > 0

There are more similar examples here:

https://www.sqlbi.com/articles/from-sql-to-dax-string-comparison/

 

Regards

how about what you wanna search is dynamic. just like a search engine you can type anything in the search box(slicer)

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.