If the calculation is not complicated you should consider using Rules to accomplish this task.
Otherwise, there should be plenty of InfoPath VBScript examples online, but the basics of the selection are:
nodeVariable = thisXDocument.DOM.selectSingleNode(___XPATH_HERE___)
The XPATH must be fully qualified, meaning it has to have all the right namespace prefixes, something like:
/dfs:myFields/dfs:dataFields/d:table/@column