Forum Discussion
How can I add between these two different tables?
I have these 2 tables, Apriso Lots (MM12) and Apriso Lots (MM24), I am trying to find a way to add certain columns where they would have a matching key. This is a picture of how the data model looks like. Thank you!
- Anonymous4 years ago
Hi Anonymous ,
Here are the steps you can follow:
1. Create calculated column.
Total = var _MM12TOTAL=CALCULATE(SUM('Aprisolots (MM12)'[ProductionTotal]), FILTER(ALL('Aprisolots (MM12)'),'Aprisolots (MM12)'[Equipment]=EARLIER('Aprisolots (MM24)'[Equipment])&&'Aprisolots (MM12)'[ProductNo]=EARLIER('Aprisolots (MM24)'[ProductNo]))) return _MM12TOTAL + 'Aprisolots (MM24)'[ProductionTotal]2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
3 Replies
- jsaunders_zero9
Responsive Resident
Is there a relationship that can be created between the two tables? If there is you can add columns using RELATED() function. If no relationship then LOOKUP() should help.
- AnonymousNot applicable
jsaunders_zero9 Thank you for the fast reply! So the two tables do not have a direct relationship but they do have similarties. They both contain [Equipment] and [ProductNo] fields. I am trying to get the sum of the production totals from each table. For example, in the image below you can see that both tables have the same [Equipment] and [ProductNo] fields, what I am trying to do is add that 421598 to 248299 to get a sum of 669897.
- AnonymousNot applicable
Hi Anonymous ,
Here are the steps you can follow:
1. Create calculated column.
Total = var _MM12TOTAL=CALCULATE(SUM('Aprisolots (MM12)'[ProductionTotal]), FILTER(ALL('Aprisolots (MM12)'),'Aprisolots (MM12)'[Equipment]=EARLIER('Aprisolots (MM24)'[Equipment])&&'Aprisolots (MM12)'[ProductNo]=EARLIER('Aprisolots (MM24)'[ProductNo]))) return _MM12TOTAL + 'Aprisolots (MM24)'[ProductionTotal]2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly