Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
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
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
8 | |
6 | |
6 | |
6 | |
5 |