Forum Discussion
murali5431
6 years agoHelper III
fill blank values with values in another column
Hi I have done most of my calculations in power query editor. As there are null values, I need to replace null values under Actual arrival date with values from Expected date of Arrival. How ...
- 6 years ago
Hi murali5431 ,
Just realized that the you have made the incorrect formula is not case but Table.
= Table.ReplaceValue(#"Time to complete entry",each [Vessel_Actual_Arrival_Date__c], each if [Vessel_Actual_Arrival_Date__c] <> null then [Vessel_Actual_Arrival_Date__c] else [Vessel_Estimated_Arrival_Date__c],Replacer.Replacevalue,{"Vessel_Actual_Arrival_Date__c"})
Jimmy801
6 years agoCommunity Champion
Hello murali5431
you can add a new column and make there a calculation like this
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjDUdSxN1zUyUNJBYsfqRCspgERMkUUMTJDUmqCrNUTojgUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Actual arrival date" = _t, #"Expected date of Arrival" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Actual arrival date", type date}, {"Expected date of Arrival", type date}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Actual arrival date new", each if [Actual arrival date]=null then [Expected date of Arrival] else [Actual arrival date]),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Actual arrival date"}),
#"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Actual arrival date new", "Actual arrival date"}})
in
#"Renamed Columns"
or you can use Table.TransformRows like this
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjDUdSxN1zUyUNJBYsfqRCspgERMkUUMTJDUmqCrNUTojgUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Actual arrival date" = _t, #"Expected date of Arrival" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Actual arrival date", type date}, {"Expected date of Arrival", type date}}),
TransRow = Table.FromRecords(Table.TransformRows(#"Changed Type",(row)=> if row[Actual arrival date]= null then Record.TransformFields(row, {"Actual arrival date", each row[Expected date of Arrival]}) else row))
in
TransRow
Copy paste this code to the advanced editor in a new blank query to see how the solution works.
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy