cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RitaWK Regular Visitor
Regular Visitor

Update a value based on another value

I have a table and there is a null based on a missing persons name.  I want to update null with a value.  This table contains an id and name. The only person I didn't have in a table with ID 685.  I want to update Forecast Manager field with the name but only for ID 685 because the rest are fine.   This person is not an employee therefore they aren't in our HR System so this is a manually name I have to enter to the model.

Need to update values.png

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Update a value based on another value

@RitaWK this will do it

 

= Table.ReplaceValue(#"Reordered Columns",each [Forecast Manager],
each if [Forecast Manager Id] = 685 and [Forecast Manager] = null then 685 else [Forecast Manager],
Replacer.ReplaceValue,{"Forecast Manager"})





Did I answer your question? Mark my post as a solution.

Proud to be a Datanaut! Appreciate your Kudos Smiley Happy
Feel free to email me with any of your BI needs.





14 REPLIES 14
Super User
Super User

Re: Update a value based on another value

@RitaWK use replace function in PowerQuery, replace null with 685

 

image.png






Did I answer your question? Mark my post as a solution.

Proud to be a Datanaut! Appreciate your Kudos Smiley Happy
Feel free to email me with any of your BI needs.





RitaWK Regular Visitor
Regular Visitor

Re: Update a value based on another value

Thanks but Replace value replaces all nulls I only need to update the null for ID 685  Forecast Manager ID 685 needs a name in the Forecast Manager field.

Super User
Super User

Re: Update a value based on another value

@RitaWK you can put the if condition in replace formula to replace it only for the value you are interested. Here is similar post on this.






Did I answer your question? Mark my post as a solution.

Proud to be a Datanaut! Appreciate your Kudos Smiley Happy
Feel free to email me with any of your BI needs.





RitaWK Regular Visitor
Regular Visitor

Re: Update a value based on another value

Could you illustrate how I would write that?  Sorry, I am very VERY new to PowerBI - Thank you!

 

RitaWK Regular Visitor
Regular Visitor

Re: Update a value based on another value

Could you illustrate how I would write that?  Sorry, I am very VERY new to PowerBI - Thank you!

 

Super User
Super User

Re: Update a value based on another value

@RitaWK here is similar post






Did I answer your question? Mark my post as a solution.

Proud to be a Datanaut! Appreciate your Kudos Smiley Happy
Feel free to email me with any of your BI needs.





RitaWK Regular Visitor
Regular Visitor

Re: Update a value based on another value

I tried to follow that logic but it doesn't like my attempt:

 

#"Reordered Columns" = Table.ReorderColumns(#"Renamed Columns1",{"ID", "Name", "Period", "Year", "Created", "Updated", "Forecast Manager ID", "Forecast Manager", "Submitted", "ResourceAllocation", "Report Period"}),
#"Replaced Value" = Table.ReplaceValue(#"Reordered Columns", each if Text.Contains([Forecast Manager ID],"685") then "Rita Carnes" else [Forecast Manager])
in
#"Replaced Value"

Super User
Super User

Re: Update a value based on another value

@RitaWK are you getting an error? Without knowing what error you are getting, it is hard to imagine what is going on.

 

What is data type for your [Forecast Manager Id] column?






Did I answer your question? Mark my post as a solution.

Proud to be a Datanaut! Appreciate your Kudos Smiley Happy
Feel free to email me with any of your BI needs.





RitaWK Regular Visitor
Regular Visitor

Re: Update a value based on another value

Expression.Error: 2 arguments were passed to a function which expects 5.
Details:
Pattern=
Arguments=List

Helpful resources

Announcements
Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Power BI Helps Homeless and Trouble Youth

Power BI Helps Homeless and Trouble Youth

We spoke with Power BI Super User, Greg Deckler, about his charity work

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Users Online
Currently online: 308 members 3,294 guests
Please welcome our newest community members: