Hello,
I have 2 tables that I have 'imported' via Power Query as a 'Connection Only'.
The 1st table is multiple values of Account code, GL and Amount.
The 2nd table is where I'd like to bring in the 'Account Description' onto the 1st table.
The Logic is that, for each records in Table 1, if the Account Code is a match in Table 2 AND in Table 2[GL] is an asterisk (*) wild card, then return the "Account Code Description" of Table 2.
However, if the Table2[GL] is not an asterisk, then IT HAS TO BE AN EXACT MATCH and return the "Account Code Description" of Table 2.
For example, PL101 and PL201 which have multiple GL combinations in Table 1, will return as 'Revenue' and 'Other Revenue' from Table 2 "Account Code Description".
But for PL301, the PL and GL must match in order to return the correct "Account Code Description" from Table 2.
i.e. PL 301 AND GL 300200 returns 'Advertising'
Table 1(Below)
Table 2 (Below)
Desired Output
I have 2 tables that I have 'imported' via Power Query as a 'Connection Only'.
The 1st table is multiple values of Account code, GL and Amount.
The 2nd table is where I'd like to bring in the 'Account Description' onto the 1st table.
The Logic is that, for each records in Table 1, if the Account Code is a match in Table 2 AND in Table 2[GL] is an asterisk (*) wild card, then return the "Account Code Description" of Table 2.
However, if the Table2[GL] is not an asterisk, then IT HAS TO BE AN EXACT MATCH and return the "Account Code Description" of Table 2.
For example, PL101 and PL201 which have multiple GL combinations in Table 1, will return as 'Revenue' and 'Other Revenue' from Table 2 "Account Code Description".
But for PL301, the PL and GL must match in order to return the correct "Account Code Description" from Table 2.
i.e. PL 301 AND GL 300200 returns 'Advertising'
Table 1(Below)
Account Code | GL | Amount |
PL101 | 100100 | 10 |
PL101 | 100200 | 20 |
PL101 | 100300 | 30 |
PL201 | 200100 | 40 |
PL201 | 200200 | 50 |
PL301 | 300100 | 60 |
PL301 | 300200 | 70 |
PL301 | 300300 | 80 |
PL301 | 300400 | 90 |
Table 2 (Below)
Account Code | GL | Account Code Description |
PL101 | *(wildcard for ALL GL in Table1) | Revenue |
PL201 | *(wildcard for ALL GL in Table1) | Other Revenue |
PL301 | 300100 | Advertising |
PL301 | 300200 | Advertising |
PL301 | 300300 | Marketing |
Desired Output
Account Code | Account Description | GL | Amount |
PL101 | Revenue | 100100 | 10 |
PL101 | Revenue | 100200 | 20 |
PL101 | Revenue | 100300 | 30 |
PL201 | Other Revenue | 200100 | 40 |
PL201 | Other Revenue | 200200 | 50 |
PL301 | Advertising | 300100 | 60 |
PL301 | Marketing | 300300 | 70 |
PL301 | Advertising | 300200 | 80 |
PL301 | Marketing | 300300 | 90 |