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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
leahschneider
Helper III
Helper III

Replace Value in Multiple Columns Conditionally

I have a table in Power Query and I need to replace values across multiple columns if one column has a particular value. I've used https://gorilla.bi/power-query/replace-values/#conditional-replace-single-step and it seems sort of helpful but I want to replace the value based on the value in the table and not just to a static number.

To use the example in that website...

Instead of this:

 

= Table.ReplaceValue(
#"Removed Other Columns",
each [Income] > 50000,
each 2,
(x,y,z)=> if y then z else x,
{"Kidhome", "Teenhome"}
)

I need:

= Table.ReplaceValue(
#"Removed Other Columns",
each [Income] > 50000,
each [whatever the value is in the column] * 2,
(x,y,z)=> if y then z else x,
{"Kidhome", "Teenhome"}
)

 

Can anyone help?

1 ACCEPTED SOLUTION
Vera_33
Resident Rockstar
Resident Rockstar

Hi @leahschneider 

 

have a try

= Table.ReplaceValue(
#"Removed Other Columns",
each [Income] > 50000,
null,
(x,y,z)=> if y then x*2 else x,
{"Kidhome", "Teenhome"}
)

View solution in original post

2 REPLIES 2
leahschneider
Helper III
Helper III

Thank you so much. This is really tough for me.

Vera_33
Resident Rockstar
Resident Rockstar

Hi @leahschneider 

 

have a try

= Table.ReplaceValue(
#"Removed Other Columns",
each [Income] > 50000,
null,
(x,y,z)=> if y then x*2 else x,
{"Kidhome", "Teenhome"}
)

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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