Forum Discussion

MJEnnis's avatar
MJEnnis
Icon for Resolver III rankResolver III
4 years ago
Solved

Replace date.time values in one column conditioned upon ID in another column

Due to a human data entry error that cannot be corrected at the source, I have to add one year to a date/time stamp for a about 10 events among 25,000. Fortunately, the events in question have a uniq...
  • KNP's avatar
    KNP
    4 years ago

    Change your Replacer.ReplaceText with Replacer.ReplaceValue.

    (I didn't test your duration addition)

    = Table.ReplaceValue(#"Renamed Columns1", each [Date], each if [ID] = 36 then [Date] + #duration(365,0,0,0) else [Date], Replacer.ReplaceValue,{"Date"})

     

    You will still run into issues with all of the types being reset to 'Any' with this method which is why I prefer the add column method.

     

    See this post...

    https://community.powerbi.com/t5/Desktop/Query-editor-replacing-values-based-on-another-column/td-p/156994