cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
IsadoraAlmeida6 Regular Visitor
Regular Visitor

Match() function in DAX?

Does power BI has some sort of match function where I pass a column, a list of values from that column, and put those values as a certain category?

For instance, the values from a col called Produtcts are: Honda, BMW, Ferrari, etc I want to group into a column called category as Car, the others values, as others.

 

In another BI tool i use a function like this Category = If(match("Produtcs", ("Honda","BMW","Ferrari"))>0, Car,Others)) 

 

Does Dax has sometning like that?

 

Thank you!

1 REPLY 1
Highlighted
magsod Member
Member

Re: Match() function in DAX?

Hi,

 

You could use the IN operator to do that kind of "match".

In your example the new column could be created with the following DAX statement:

 

Category =

IF (

     'Table'[Products] IN { "Honda", "BMW", "Ferrari"},

     "Car",

     "Others"
)

 

Br,

Magnus