cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

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!

4 REPLIES 4
magsod
Solution Supplier
Solution Supplier

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

is there function equivalent to "IN with wildcard"? for example match x IN { "foo*, fo-o*", "bar"}

Old question, but never answered.  I have 1.8 million rows and 1400 distinct values.  It simply isn't practical to list them on the command line, not to mention, it's an easy match -- the first two or three characters will get me where I need to be.  Awk is looking more promising.

CONTAINSSTRING might help

Helpful resources

Announcements
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Get Ready for Power BI Dev Camp

Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Kudoed Authors