Forum Discussion
Fill empty row with value from column to the left
Hi,
I'd like som help here. I have a hierarchy of my Organisation. Problem in this case is if you look at the top path path 3,4,5 blanks out. And that unfortunately gives a blank row in the slicer aswell. So I was thinking if it would be possible to write an if statement saying. If a column is blank look one to the left. So for path 3 in this case it would write Hus again. Any suggestions?
Hi soderqvistn
In Query Editor
- Select [PATH2]
- go to Transform > Replace Values and do the following.
- The above will create a step "Replaced Value", select it and remove quotes from around "each [PATH1]" like below
Table.ReplaceValue(#"Changed Type","", each [PATH1] ,Replacer.ReplaceValue,{"PATH2"}) - Repeat the process for all other columns [PATH3] replace with [PATH2]
Best Regards,
Mariusz
If this post helps, then please consider Accepting it as the solution.
Please feel free to connect with me.
7 Replies
- Mariusz
Community Champion
Hi soderqvistn
In Query Editor
- Select [PATH2]
- go to Transform > Replace Values and do the following.
- The above will create a step "Replaced Value", select it and remove quotes from around "each [PATH1]" like below
Table.ReplaceValue(#"Changed Type","", each [PATH1] ,Replacer.ReplaceValue,{"PATH2"}) - Repeat the process for all other columns [PATH3] replace with [PATH2]
Best Regards,
Mariusz
If this post helps, then please consider Accepting it as the solution.
Please feel free to connect with me.- soderqvistn
Helper I
Mariusz wrote:Hi soderqvistn
In Query Editor
- Select [PATH2]
- go to Transform > Replace Values and do the following.
- The above will create a step "Replaced Value", select it and remove quotes from around "each [PATH1]" like below
Table.ReplaceValue(#"Changed Type","", each [PATH1] ,Replacer.ReplaceValue,{"PATH2"}) - Repeat the process for all other columns [PATH3] replace with [PATH2]
Best Regards,
Mariusz
If this post helps, then please consider Accepting it as the solution.
Please feel free to connect with me.Can you explain step 3 a bit mroe detailed?
- Mariusz
Community Champion
Hi soderqvistn
Sure, step 2 is replacing the blank value with the text "each [PATH1]" in step 3 you are removing quotes from this text and by that, you are transforming text to M expression "each" is scanning every blank row within your column and replacing it with "[PATH1]" column value.
As a result, for every empty row in column [PATH2] you will get the value of [PATH1].
Let me know if this makes sense for you.
Best Regards,
Mariusz
If this post helps, then please consider Accepting it as the solution.
Please feel free to connect with me.