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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
AndrewPF
Helper V
Helper V

if else statement without creating new column

I have a simple IF statement which corrects the value of "Group" for specific instances, for example: 

 

= Table.AddColumn(#"Previous Step", "New Group", each
     if [Name] = "Batman" then "DC"
else if [Name] = "Wonder Woman" then "DC"
else if [Name] = "Iron Man" then "Marvel"
else if [Name] = "Goofy" then "Disney"
else if [Name] = "Mickey Mouse" then "Disney"
else [Group])

 

but the only way I have found of doing this is to create a new column - "New Group". 

 

Is there any way of altering this code so that I alter the value of "Group" instead of adding the new column "New Group"? 

1 ACCEPTED SOLUTION
Pragati11
Super User
Super User

Hi @AndrewPF ,

 

You can try multile replace statements on the Group column rather than trying to create a new column.

You can follow this trick here for creating multiple replacement staements as a SINGLE statement in Power Query:

https://www.youtube.com/watch?v=cOXNbaa_02U

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

View solution in original post

1 REPLY 1
Pragati11
Super User
Super User

Hi @AndrewPF ,

 

You can try multile replace statements on the Group column rather than trying to create a new column.

You can follow this trick here for creating multiple replacement staements as a SINGLE statement in Power Query:

https://www.youtube.com/watch?v=cOXNbaa_02U

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.