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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
admin11
Memorable Member
Memorable Member

How to recode 100 brand into 1 brand with Other Brand ?

Hi All

 

I have a Field name BRAND_ :-

admin11_0-1655336118584.png

 I like to recode the BRAND_ to BRAND_P only display "YASKAWA" Brand :-

BRAND_P =
IF ( 'SALES'[BRAND_] = Blank(),
"No Brand",if(SALES[BRAND_] in
{"YASKAWA"},
'SALES'[BRAND_], "Other"))
 
I get return with out YASKAWA brand :-
admin11_1-1655336342302.png

Can some one share with where go wrong ?

 

Paul

1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

Hi @admin11 

 

Your BRAND_ column doesn't actually contain the string "YASKAWA".  It contains the strings " YASKAWA" and "YASKAWA "- note the leading and trailing space.

 

That's why your code isn't working.

 

Clean up the BRAND_ column by removing spaces - you can use Text.Trim in Power Query.

 

regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

7 REPLIES 7
PhilipTreacy
Super User
Super User

Hi @admin11 

 

Your BRAND_ column doesn't actually contain the string "YASKAWA".  It contains the strings " YASKAWA" and "YASKAWA "- note the leading and trailing space.

 

That's why your code isn't working.

 

Clean up the BRAND_ column by removing spaces - you can use Text.Trim in Power Query.

 

regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


@PhilipTreacy

Thank you for your input

it will help me save a lot of my time

 

Paul 

VahidDM
Super User
Super User

Hi @admin11 

 

Try this:

 

BRAND_P =
IF('SALES'[BRAND_]="YASKAWA","YASKAWA",blank())

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Appreciate your Kudos!! 

Badges.jpg

LinkedIn | Twitter | Blog | YouTube 

@PhilipTreacy @VahidDM 

The issue cause by below :-

 
BRAND_ =
IF(
'SALES'[BRAND_SAP_] & " " & 'SALES'[BRAND_5] = " ",
"No Brand",
'SALES'[BRAND_SAP_] & " " & 'SALES'[BRAND_5]
)
 
Paul
 
PhilipTreacy
Super User
Super User

Hi @admin11 

 

Download sample PBIX file

 

Create a new column using your code then it should work fine

brandp2.png

 

brandp.png

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Hi Philip

Thank you for your help.

I found the solution , it work fine now :-
FLAG_UR_SD_TDS = if('SALES'[STOCK_CODE] in {"URD110105","URD110110","URD110203","URD110205","URD110210","URD110216","URD110303","URD110305","URD110310","URD110312","URD110203","URD110203","N15975","N16049","N16338","N15528","N17094","N16912","N17748","N17877","N16049"},"1", "0")
 

@PhilipTreacy 

I have try on my PBI file , it dos not work.

admin11_0-1655340018192.png

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

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.