Forum Discussion
Change a cell without create a new colunm
Hi Mendes094 ,
To update Value directly without a new column:
let
Source = YourTable,
UpdatedTable = Table.TransformColumns(Source, {{"Value", each if [Type] = "B" then 0 else _, type number}})
in
UpdatedTable
This modifies Value based on Type without adding a new column.
Hi rohit1991, this won't work in my opinion. You can't refer another column in Table.TransformColumns. That is the reason why I showed solution with Table.TransformRows.
- rohit19911 year ago
Super User
Hi dufoq3,
TransformColumns cannot reference another column. Here's an alternative approach using Table.TransformRows to update the Value column without creating a new one:
let
Source = YourTable,
UpdatedTable = Table.FromRecords(
Table.TransformRows(Source, each Record.TransformFields(_, {{"Value", if _[Type] = "B" then 0 else _[Value]}}))
)
in
UpdatedTable
This method ensures the Value column is updated based on the Type without creating a new column. Let me know if you have further questions or need more clarification!