Forum Discussion
Transform to negative numbers
- 9 years ago
If you expenses are in their own column, just choose Standard | Multiply from the Number Column area of the Transform ribbon and enter -1. Here is the M code:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtY31zcyMDRX0lEyNVCK1QGJWMBEDA2AQrEA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Date = _t, Value = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Value", Int64.Type}}), #"Multiplied Column" = Table.TransformColumns(#"Changed Type", {{"Value", each _ * -1, type number}}) in #"Multiplied Column" - 9 years ago
You can add a conditional column and then delete the original one.
let Source = Excel.Workbook(File.Contents("C:\ Transform to negative numbers.xlsx"), null, true), Table1_Table = Source{[Item="Table1",Kind="Table"]}[Data], #"Changed Type" = Table.TransformColumnTypes(Table1_Table,{{"data", type date}, {"tipo", type text}, {"destino", type text}, {"meio", type text}, {"conta", type text}, {"valor", Int64.Type}}), #"Added Conditional Column" = Table.AddColumn(#"Changed Type", "valor_updated", each if [tipo] = "Saída" then -[valor] else [valor] ), #"Changed Type1" = Table.TransformColumnTypes(#"Added Conditional Column",{{"valor_updated", Int64.Type}}), #"Removed Columns" = Table.RemoveColumns(#"Changed Type1",{"valor"}), #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"valor_updated", "valor"}}) in #"Renamed Columns"Best Regards,
Herbert
hi im trying to show a positive data feed as a negaive line in a mortgage graph that already has a negative feeds
=(Calcs!$T$46:$Y$46,Calcs!$AA$46:$AF$46,Calcs!$AJ$46:$AO$46,Calcs!$AQ$46:$AV$46,Calcs!$AZ$46:$BE$46,Calcs!$BG$46:$BL$46,Calcs!$BP$46:$BU$46,Calcs!$BW$46:$CB$46,Calcs!$CF$46:$CK$46,Calcs!$CM$46:$CR$46,Calcs!$CV$46:$DA$46,Calcs!$DC$46:$DH$46,Calcs!$DL$46:$DQ$46,Calcs!$DS$46:$DX$46,Calcs!$EB$46:$EG$46,Calcs!$EI$46:$EN$46,Calcs!$ER$46:$EW$46,Calcs!$EY$46:$FD$46,Calcs!$FH$46:$FM$46,Calcs!$FO$46:$FT$46)
i have tried *-1 and adding a minus to the front but i just get formula error messages