Forum Discussion
Anonymous
6 years agoNot applicable
Filling blank values in a dataset based on a shared value on a nother column
Hi everyone I have a dataset where I have invoices with associated company names and also an associated Salesforce ID. However, some SFIDs in this fact table are blank for some reason I'm not goin...
- 6 years ago
Hi Anonymous ,
We can add a custom column then remove the origin one to meet your requirement:
let c = [COMPANY] in if [SFID] = null then Table.Max(Table.SelectRows(#"Changed Type",each [COMPANY]=c),{"SFID"})[SFID] else [SFID]All the queries are here:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUXJ0cgaShkbGSrE60UpGcBEw1xiVawJkODm7AEkTUzOwiClcBMw1AzJc3dzB3FgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [INVOICE = _t, COMPANY = _t, SFID = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"INVOICE", Int64.Type}, {"COMPANY", type text}, {"SFID", Int64.Type}}), #"Added Custom" = Table.AddColumn(#"Changed Type", "SFID_2", each let c = [COMPANY] in if [SFID] = null then Table.Max(Table.SelectRows(#"Changed Type",each [COMPANY]=c),{"SFID"})[SFID] else [SFID]), #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"SFID"}), #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"SFID_2", "SFID"}}) in #"Renamed Columns"
Best regards,
Anonymous
6 years agoNot applicable
Amazing, thanks