Forum Discussion
hello_MTC
4 years agoHelper III
Create new column from existing columns
From above table i want to create a new column(yellow color) and get the data from existing columns(orange color). Priority should be as below: 1_ override_outcome 2_ final_recommendat...
- 4 years ago
Please paste the data alongwith column names where problem is
Vijay_A_Verma
4 years agoMost Valuable Professional
See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test (later on when you use the query on your dataset, you will have to change the source appropriately. If you have columns other than these, then delete Changed type step and do a Changed type for complete table from UI again)
If you already getting nulls in place of space, then #"Replaced Value" step is not required for you.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Xc47DoAgEATQu1BT8BGB0k+tEUvC/a8hDAtBEpaYvJmVGJlknCnr823yHG3qR+KRqRJwYgjQKaiBcm6H3l4QUC0Q/nUD1aP2SPEVvkzr777dws3Yv2r9gjv4Sr7l2WnHCfdwS/7Uamh/lwLsiPN529vSBw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [id = _t, incident_id = _t, user_id = _t, stander_outcome = _t, recomanded_outcome = _t, override_outcome = _t, final_rcommendation_outcome = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"id", Int64.Type}, {"incident_id", Int64.Type}, {"user_id", Int64.Type}, {"stander_outcome", type text}, {"recomanded_outcome", type text}, {"override_outcome", type text}, {"final_rcommendation_outcome", type text}}),
#"Replaced Value" = Table.ReplaceValue(#"Changed Type","",null,Replacer.ReplaceValue,{"stander_outcome", "recomanded_outcome", "override_outcome", "final_rcommendation_outcome"}),
#"Added Custom" = Table.AddColumn(#"Replaced Value", "latest", each List.RemoveNulls({[override_outcome]}&{[final_rcommendation_outcome]}&{[recomanded_outcome]}&{[stander_outcome]}){0})
in
#"Added Custom"
hello_MTC
4 years agoHelper III
Will this code remove duplicates? If yes, then i do not want to remove duplicates.
- Vijay_A_Verma4 years agoMost Valuable Professional
No duplicates removed.