Forum Discussion
tgarthaffner
7 months agoNew Member
Change random dates
I have a data set where there is a column with dates when a particular instance became ready for the next step. I want to convert any field in that column that has a date to read "INSTALL READY" inst...
- 7 months ago
Hi,
In Power Query, Add a Custom Column and update [Column] to your actual Column name,if Value.Is([Column], type date)
or Value.Is([Column], type datetime)
then "INSTALL READY"
else if [Column] = null or [Column] = 0
then null
else Text.From([Column]) - 7 months ago
You can use the Table.ReplaceValue function, but you need to write custom M code in the Advanced Editor:
Source Data
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtQ31TcyMDJVitWJVjIAk2DC0Ejf2BAkYwLmmugbmoN4FggVSIpN4YbEAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type any}}), #"Replace Dates" = Table.ReplaceValue( #"Changed Type", each [Date], "INSTALL READY", (x,y,z)=>if Value.Is(Date.From(y),type date) then z else y, {"Date"}) in #"Replace Dates"Results
v-echaithra
6 months agoCommunity Support
Hi tgarthaffner ,
Thank you ronrsnfld , MasonMA for your inputs.
I just wanted to check if the issue has been resolved on your end, or if you require any further assistance. Please feel free to let us know, we’re happy to help!
Thank you