# Add Column with subtraction formula [Power Query 2013)



## kachaloo (Mar 11, 2020)

Hello all
I am very new to Power Query and still learning. I have figured that my Excel formulas are not working here 

I would like to add a column to a query from table columns Cr and Dr. I want to get result in New column "Subtraction" as Cr-Dr..  
i.e  -5939.91, 1900 and so on.

Any tips please.

Thank you


----------



## sandy666 (Mar 11, 2020)

try

```
#"Replaced Value" = Table.ReplaceValue(#"Changed Type",null,0,Replacer.ReplaceValue,{"Dr", "Cr"}),
    #"Inserted Subtraction" = Table.AddColumn(#"Replaced Value", "Subtraction", each [Cr] - [Dr], Int64.Type)
```


----------



## kachaloo (Mar 12, 2020)

Good morning @sandy666 
I have copied and pasted it custom column. get error Token Eof expected it highlights "," 
Not working for me I guess I don't know how to use it 
If I remove the subtraction column and add custom column. how this formula will be modified. 
Thanks


----------



## sandy666 (Mar 12, 2020)

As I see you are really


kachaloo said:


> very new to Power Query and still learning


post you code here
or
select both columns then replace _null_ to *0*
then do what you did before, *Cr-Dr*


----------



## sandy666 (Mar 12, 2020)

select Cr and Dr then replace null to 0




then select Cr and Dr (the order of selection matters) then


----------



## kachaloo (Mar 12, 2020)

No this is more like it 
Perfect. Thank you


----------



## sandy666 (Mar 12, 2020)

You are welcome
Have a nice day


----------

