Forum Discussion
Help needed with data preparation (using M)
- 6 years ago
Hi Anonymous,
it seems like you are taking on the advanced editor in Power Query. Perhaps an easier way to do this is to first create a new column with the value from Update, and then create another column according to the logic you have. Once that is completed you can remove the original m3-column and the When-column.
If you still want to do this in Advanced editor, I think this will work for you:
= Table.ReplaceValue(#"Previous step", each [m3], each if [Reading] <= List.First(Update[When]) then [m3] else null, Replacer.ReplaceValue, {"m3"} )Cheers,
Sturla
If this post helps, then please consider Accepting it as the solution. Kudos are nice too.
Hi Anonymous,
it seems like you are taking on the advanced editor in Power Query. Perhaps an easier way to do this is to first create a new column with the value from Update, and then create another column according to the logic you have. Once that is completed you can remove the original m3-column and the When-column.
If you still want to do this in Advanced editor, I think this will work for you:
= Table.ReplaceValue(#"Previous step", each [m3], each if [Reading] <= List.First(Update[When]) then [m3] else null, Replacer.ReplaceValue, {"m3"} )
Cheers,
Sturla
If this post helps, then please consider Accepting it as the solution. Kudos are nice too.
- Anonymous6 years agoNot applicable
Thanks mate, your solution solved the issue!
Also thanks for your suggestion, I believe it would be an easier way to solve the problem but I was afraid the impact in performance would hurt the model as a whole - that's why I opted to use the editor and dedicate an effort to learn M.