Forum Discussion

jbenson's avatar
jbenson
Icon for Helper III rankHelper III
5 years ago
Solved

Weighted Basis AVG

i am trying to find the average basis of corn and soybean commodities. i have the basis amont that each contract was purchased at, the total bushels each contract bought and how many different contracts was purchased by a certain person. i am not coming up with the correct avg basis. what is the correct formula. Here is how my columns are laid out. 

 

 

AccountNo     Basis     Bushels

1                      -0.35      1000

1                      -0.35       950

1                      -0.40      1000

1                      -0.35       2000

 

Thank you

  • Hello, try something like:

     

    w_avg = sumx(table, Basis * Bushels) / sumx(table, Bushels)

     

     

1 Reply

  • samdthompson's avatar
    samdthompson
    Icon for Memorable Member rankMemorable Member

    Hello, try something like:

     

    w_avg = sumx(table, Basis * Bushels) / sumx(table, Bushels)