Forum Discussion

Bassil74's avatar
Bassil74
Helper I
2 years ago

Copy values from one column to another in selected rows

I have column A in table T1 which has two columns x and y, column x has null values, column y has y1,y2 values in the corresponding cells of the null cells in column x. I need formula in M language to copy the value of y1,y2 to replace null values in column x

4 Replies

  • wdx223_Daniel's avatar
    wdx223_Daniel
    Community Champion

    NewStep=Table.ReplaceValue(YourTableName,each [Column x],"",(x,y,z)=>x??y,{"Column y"})

  • Thanks wdx223_Daniel  this is still not working for me, the formula i put is = Table.ReplaceValue(Expand_Cluster,each [clusterId],"",(x,y,z)=>[clusterId]??[clusterId.1],{"clusterId.1"}) 

    and it returns no change to column clusterId which is expected to change to the values from clusterId.1 column. 

    • wdx223_Daniel's avatar
      wdx223_Daniel
      Community Champion

      Table.ReplaceValue(Expand_Cluster,each [clusterId],"",(x,y,z)=>x??y,{"clusterId.1"})

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Bassil74 ,

     

    You want to put copy 3 and 4 from y column to x column, right?

    Just add a custom column.

     

    If your column x null value appears as null, you can modify the custom as follows.

    Best Regards,

    Stephen Tao

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.