cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Helper III

## Match Serval Text in Measure

Hi All,

Right now, I am using contains function to match the text in "Measure" and show it in "Table". May I know if there is any easy way to acheive the same result ? If possible, is it able to do it in wild match? (I would like to do it in visualization instead of add new column in dataset).

My current express in Measure is as follow.

1 ACCEPTED SOLUTION
Community Support

Hi @KH_Mike ,

Try

``````Measure=
SWITCH (
MAX ( 'Data'[Country] ),
"USA", "AMR",
MAX ( 'Data'[Country] )
)``````

or

``````Measure=
IF (
MAX ( 'Data'[Country] ) = "USA"
|| MAX ( 'Data'[Country] ) = "CANADA",
"AMR",
MAX ( 'Data'[Country] )
)``````

The MAX function is equivalent to getting the value of the current row, and the MIN function can also achieve the same effect.

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.

4 REPLIES 4
Super User

@KH_Mike , I think you have to do like, what you are doing

Measure = if(CONTAINSSTRING(Data,Data[Country],"USA") || CONTAINSSTRING(Data,Data[Country],"CANADA"),"AMR",Data[Country])

Helper III

Hi @amitchandak ,

I want to know if there is any function like Switch in Excel can make it formula short. Also, if I only input "Data[Country]" at the end. It seems can't work  correctly.

Community Support

Hi @KH_Mike ,

Try

``````Measure=
SWITCH (
MAX ( 'Data'[Country] ),
"USA", "AMR",
MAX ( 'Data'[Country] )
)``````

or

``````Measure=
IF (
MAX ( 'Data'[Country] ) = "USA"
|| MAX ( 'Data'[Country] ) = "CANADA",
"AMR",
MAX ( 'Data'[Country] )
)``````

The MAX function is equivalent to getting the value of the current row, and the MIN function can also achieve the same effect.

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.

Helper III

That exactly what I need. Thank you.

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - August 2024

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

#### Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

#### Fabric Community Update - September 2024

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

Top Solution Authors
Top Kudoed Authors