Forum Discussion
pelucapampa
Helper I
7 years agoSum by Value in other Column
Hi All, how are you?? I need some help.
I've a table with some columns
| Date | OrganizationType | RazonSocial |
| 01/11/2017 | PARTICULAR | |
| 01/04/2016 | CORPORATIVO | CLEO INFORMACION ESPECIALIZADA SRL |
| 01/04/2017 | CORPORATIVO | CLEO INFORMACION ESPECIALIZADA SRL |
| 01/10/2016 | PARTICULAR |
I need to replace OrganizationType with "DIRECT" when RazonSocial have "PARTICULAR".
I tried with Table.ReplaceValue, but i couldn't make it.
1 Reply
- Greg_Deckler
Community Champion
You could always do something like this:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtQ3NNQ3MjA0V9JRAqIAx6AQT+dQH8cgpVgdkKwJSNIMKOPsHxTgH+QY4hnmD+Q9augGImcfV38FTz83/yBfR2dPfz8F1+AAV2dPRx/PKEcXR4XgIB9kU8wpNcXQAOYYNJfGAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Date = _t, OrganizationType = _t, RazonSocial = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"OrganizationType", type text}, {"RazonSocial", type text}}), #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each if [RazonSocial] = "PARTICULAR" then "DIRECT" else [OrganizationType]), #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"OrganizationType"}), #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Custom", "OrganizationType"}}) in #"Renamed Columns"