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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
NickProp28
Post Partisan
Post Partisan

switch SEARCH

Dear community, 

 

NickProp28_1-1670919211789.png

 

I have customer codes concatenated into one and form customer list, now I would like to determine if the list will have these customers.

'AAA' , 'BBB', 'CAC' ,'CCC' , 'AEW', 'ABC', 'BAC' .... (more than 50). 

If yes, it will be categorized as 'NICE'. 

 

Category = 
SWITCH (
    TRUE (),
    SEARCH ( "AAA", Combine[Customer list], 1, 0 ) > 0, "NICE",
    SEARCH ( "BBB", Combine[Customer list], 1, 0 ) > 0, "NICE",
    "NON NICE"
)

I wonder if there is an easier way to do this, since I will have to type SEARCH more than 50 times...

Appreciate any help provided!

 

1 ACCEPTED SOLUTION
TomMartens
Super User
Super User

Hey @NickProp28 ,

 

I recommend using Power Query instead of creating a calculated column with DAX.

Here you will find a pbix file that contains an example using Power Query: https://tommartens-my.sharepoint.com/:u:/g/personal/tom_minceddata_com/Ef26aLnUwbJNk4CBMmb6hzUBH5CLT...

The above solution is based on two tables, one containing all the "possible values" and one where these possible values might appear.

I consider using Power Query more appropriate as a calculated DAX column will not be as much compressed as native or Power Query columns during data load/data refresh.
Another advantage is that the table containing the possible values can easily be adapted.

Hopefully, this provides what you are looking for.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

3 REPLIES 3
Manoj_Nair
Solution Supplier
Solution Supplier

@NickProp28 - try the PBIX file (low code). Agree with @TomMartens suggestion to use PowerQuery instead of DAX calculated column.

Please let me know if this answered your question. I would be happy if you could mark my post as a solution and give it a thumbs up

Best regards
Manoj Nair
Linkedin - https://www.linkedin.com/in/manoj-nair-%E2%98%81-344666104/

@NickProp28 - the reason for using “Comparer.OrdinalIgnoreCase” to factor if in future you have distinct values ( ie BBB, AAA etc) which are case insensitive compared. For more details check Microsoft documentation.

TomMartens
Super User
Super User

Hey @NickProp28 ,

 

I recommend using Power Query instead of creating a calculated column with DAX.

Here you will find a pbix file that contains an example using Power Query: https://tommartens-my.sharepoint.com/:u:/g/personal/tom_minceddata_com/Ef26aLnUwbJNk4CBMmb6hzUBH5CLT...

The above solution is based on two tables, one containing all the "possible values" and one where these possible values might appear.

I consider using Power Query more appropriate as a calculated DAX column will not be as much compressed as native or Power Query columns during data load/data refresh.
Another advantage is that the table containing the possible values can easily be adapted.

Hopefully, this provides what you are looking for.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors