Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowGet inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.
Hi,
I'm having trouble using the Table.ReplaceValue function with a condition.
I want to replace the values in one field (Print), with the values in another field (REPLACE Print), but only if the value on that row in the 'REPLACE Print' field is there.
For example I have a lot of rows where I have a value in the 'Print' column which needs to be replaced with the new value in the 'REPLACE Print' column. But also some null rows in the 'Print' column which need to be replaced with the value in 'REPLACE Print' column.
Can anyone advise how I fix this formula, I want to minimise adding helper columns and instead do the whole task in the one step.
#"Replaced print" = Table.ReplaceValue(#"Replaced end use", each [Print], each if [REPLACE Print] = null then [Print] else [REPLACE Print], Replacer.ReplaceText,{"Print"})
Many thanks in advanced!
Best,
Dan
Solved! Go to Solution.
Hello! Please give this a try...
= Table.ReplaceValue(#"Previous Step Name", each [Print], each [REPLACE Print] ?? [Print], Replacer.ReplaceValue,{"Print"})
This statement says exactly what you are trying to do. The other difference between it and your script is that you had the replacer function as Replacer.ReplaceText (partial value) instead of Replacer.ReplaceValue (entire value).
BEFORE:
AFTER:
If this post helps to answer your questions, please consider marking it as a solution so others can find it more quickly when faced with a similar challenge.
Proud to be a Microsoft Fabric Super User
Hello! Please give this a try...
= Table.ReplaceValue(#"Previous Step Name", each [Print], each [REPLACE Print] ?? [Print], Replacer.ReplaceValue,{"Print"})
This statement says exactly what you are trying to do. The other difference between it and your script is that you had the replacer function as Replacer.ReplaceText (partial value) instead of Replacer.ReplaceValue (entire value).
BEFORE:
AFTER:
If this post helps to answer your questions, please consider marking it as a solution so others can find it more quickly when faced with a similar challenge.
Proud to be a Microsoft Fabric Super User
Hey!
This worked great, thank you
Best,
Dan
Wonderful! Please consider giving my solution a thumbs-up and marking it as an accepted solution.
If this post helps to answer your questions, please consider marking it as a solution so others can find it more quickly when faced with a similar challenge.
Proud to be a Microsoft Fabric Super User
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
31 | |
30 | |
20 | |
15 | |
12 |
User | Count |
---|---|
20 | |
18 | |
13 | |
10 | |
10 |