Forum Discussion
IF + Lookupvalue from partial text
Hi Power User!
I have the following tables:
TABLE 1
| Code 1 | Description 1 | Code 2 | Description 2 | Code 3 |
| 1.10 | Text 1 | 1.10.1 | Text 1 | 1.10.1 |
| 1.100 | Text 2 | 1.10.2 | Text 2 | 1.100.2 |
| 1.110 | Text 3 | 1.20.1 | Text 3 | 1.110.1.1 |
| 1.120 | Text 4 | 1.20.2 | Text 4 | 1.120.2.1.1.1 |
TABLE 2
| Account | Account_Description | Code 3 | Description 1 |
| 3000100 | Text 1 | 1.10.1 | |
| 3000101 | Text 2 | 1.10.2 |
I would like to insert in the field "Description 1" of table 2 the filed "Description 1 from Table 1" with a lookup value between the code 3 of table 1 and code 1 of table 1.
The main problem is that there is a partial match between code 1 and code 3, code 3 is a higher level of detail. Only the first digit are the same.
I tried with this code :
- Anonymous6 years ago
i guess ... this approach
let Table2= ... tt=Table.AddColumn(Table2, "Code 12", each Table.SelectRows(Table1, (r)=>Text.BeforeDelimiter(r[Code 3],".",2 )=Text.BeforeDelimiter(_[Code 3],".",2))), #"Expanded Code 12" = Table.ExpandTableColumn(tt, "Code 12", {"Code 1", "Code 2"}) in #"Expanded Code 12"
10 Replies
- MFelixSuper User
Hi Anonymous ,
This is possible to do however I don't understand what is the link between both codes.
So for the example you are giving you are comparing the 1.10 code 3 (first part) with the 1.10 of code 1?
What is the part of the code or how do you compare both values?
- AnonymousNot applicable
Hi Anonymous ,
Could you please provide the calculation logic of Description 1 in Table 2 and your expected result? Whether the logic is when the value of Code 3 in Table 2 is between Code 1 and Code 3 of Table 1, then return the value of Description 1 of Table 1? Then the final expected result is what the below table display like?
Account Account_Description Code 3 Description 1 3000100 Text 1 1.10.1 Text 1 3000101 Text 2 1.10.2 Best Regards
Rena
- AnonymousNot applicable
Thank you all guys, I solved the problem. Sorry if I hadn't been clear in explaining the question.
Best
- AnonymousNot applicable
Hi Anonymous ,
Thanks for your feedback. It's glad to hear that your problem has been resolved. Could you please mark it as Answered since it has been resolved? Thank you.
Best Regards
Rena
- AnonymousNot applicable
i guess ... this approach
let Table2= ... tt=Table.AddColumn(Table2, "Code 12", each Table.SelectRows(Table1, (r)=>Text.BeforeDelimiter(r[Code 3],".",2 )=Text.BeforeDelimiter(_[Code 3],".",2))), #"Expanded Code 12" = Table.ExpandTableColumn(tt, "Code 12", {"Code 1", "Code 2"}) in #"Expanded Code 12"- AnonymousNot applicable
Thank you Anonymous , I solved with this code and some changes, thank you for the advice.