Forum Discussion
LaurentZ
Helper I
6 years agoCompare 2 tables easily - how do you do ?
Hi, I've 2 tables: - the first contains a forecast on a month (with a breakdown by customers and products) => imported in PQ as "OLD" - the second countains the true realization on the same mon...
LaurentZ
Helper I
6 years agoOk, then
I've this table in Excel imported in Power Query as NEW:
| Scenario | Customer | Product | Quantity |
| Actuals | A | 1 | 5 |
| Actuals | B | 1 | 5 |
| Actuals | B | 2 | 1 |
I've this table in Excel imported in Power Query as OLD:
| Scenario | Customer | Product | Quantity |
| Forecast | A | 1 | 3 |
| Forecast | B | 2 | 2 |
First, I want a creation of a table by Power Query, giving me the difference between Tables NEW and OLD
| Scenario | Customer | Product | Quantity |
| Difference | A | 1 | 2 |
| Difference | B | 1 | 5 |
| Difference | B | 2 | -1 |
and finaly append those 3 tables to a final table:
| Scenario | Customer | Product | Quantity |
| Actuals | A | 1 | 5 |
| Actuals | B | 1 | 5 |
| Actuals | B | 2 | 1 |
| Forecast | A | 1 | 3 |
| Forecast | B | 2 | 2 |
| Difference | A | 1 | 2 |
| Difference | B | 1 | 5 |
| Difference | B | 2 | -1 |
How would you proceed ?
Note that this is very simplified, database are both >100,000 lines by tables and I've 18 columns of drivers for values (Quantity, turnover...)