Skip to main content
cancel
Showing results for 
Search instead 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

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
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

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

Sept NL Carousel

Fabric Community Update - September 2024

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

Top Solution Authors
Top Kudoed Authors