Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Help needed with data preparation (using M)

Hey ppl! I've received a new task and need to learn M fast. Problem is, I have a "simple" problem to solve but didn't learn enough M yet to solve it in a timely manner. Hope you guys can help.   ...
  • sturlaws's avatar
    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.