This particular answer might apply to your scenario:
https://powerusers.microsoft.com/t5/General-Discussion/Syntax-for-joining-tables/td-p/61387
That is mainly about views vs. actually joining the data, but it likely applies. I'll go ahead and try to connect this to your own scenario.
One thing you might want to be clear about is if you're using a Table or a Collection. This can get confusing. In fact, some of Microsoft's own documentation doesn't make a clear distinction between Tables and Collections. I am going to cross into using a Collection for this below but will try to make it as clear as possible.
Another thing is that some of the Table/Collection functions you might be trying to use do not actually modify the Table/Collection directly. What this means is that functions like AddColumns() don't actually add columns to the Table. They return a new Table that includes the old table plus the new columns. So AddColumns(myTable,...) does not modify myTable. You would use it more like: UpdateContext({newTable:AddColumns(myTable,...)}).
For the sake of argument, let's assume you have created a pair of tables (tblActuals and tblCommited) similar to this:
UpdateContext({tblActuals:Table({Project:"Project1",FY:2018,FinancialItem:"Play Dough",Internal:1000,External:40})});
UpdateContext({tblCommitted:Table({Project:"Project1",FY:2018,FinancialItem:"Play Dough",Internal:50,External:20})})Then you have two tables w/ a single record that represent the Actuals and Committed values for a particular project/year (e.g. Project1 and 2018 respectively). There could be hundreds of records in the table, but I just did one for simplicity. I think that's what you stated that you're working with. Two tables that represent the same project/year but are divided by whether they are Committed or Actual.
I can create a new Collection that contains everything from one of the two tables by doing something similar to this:
ClearCollect(colMerged,RenameColumns(tblActuals,"Internal","InternalActual","External","ExternalActual"))
To understand what happened here, in one command we empty and create a new Collection called colMerged and then we add all of the records from the table tblActuals, however, we change the names of the columns Internal and External first to represent your new names InternalActual and ExternalActual.
But we're missing the other new columns that include the Committed values. We can modify the above command to include them like so:
ClearCollect(colMerged,RenameColumns(AddColumns(tblActuals,"InternalCommitted",0,"ExternalCommitted",0),"Internal","InternalActual","External","ExternalActual"))
This creates our new Collection as above, but also drops in two additional columns that we can use to merge everything in from the other table (i.e. tblCommitted). Right now the table would contain all of the records from tblActuals, the two new columns needed for the Committed values, but they'd have Zero for their values.
But let's go ahead and bring it all together by using this:
ClearCollect(colMerged,RenameColumns(AddColumns(tblActuals,"InternalCommitted",LookUp(tblCommitted,Project=tblActuals[@Project] And FY=tblActuals[@FY],Internal),"ExternalCommitted",LookUp(tblCommitted,Project=tblActuals[@Project] And FY=tblActuals[@FY],External)),"Internal","InternalActual","External","ExternalActual"))
Now this is a super mouthful and confusing. Also, doing references to values that are identically named across two tables is EXTRA confusing. The last thing we're adding here is a Lookup() function that is going to get values from tblCommitted that match the Project and FY of the record we're currently adding from tblActual.
LookUp(tblCommitted,Project=tblActuals[@Project] And FY=tblActuals[@FY]
The part that might be new to you is the [@Project] portion. Essentially, in English, we're looking up a record from the table tblCommitted where the column Project / FY from that table matches the column Project / FY from the record within tblActuals that we're currently adding to the new collection colMerged.
Sooooo easy.
😉