【问题标题】:Best way to implement lookup tables in Excel Power Query在 Excel Power Query 中实现查找表的最佳方法
【发布时间】:2020-01-09 21:57:13
【问题描述】:

我有一个国家值表,如下所示:

SourceCode       TranslationCode
United States    USA
US               USA
Great Britain    GBR
England          GBR
Source Customer Table
CustNbr     CustName      Country
12345       Acme Tools    United States
23456       Smith and Co  US
34567       Rogers Assoc  Great Britain
--Expected Result--
CustNbr     CustName      Country
12345       Acme Tools    USA
23456       Smith and Co  USA
34567       Rogers Assoc  GBR

在 Power Query 中,处理此问题的最佳方法是什么,以便我可以动态引用查找表? 最终用户可能需要将值添加到查找/翻译表中,并期望在下次执行流程时包含/替换这些值。

提前致谢。

【问题讨论】:

    标签: excel powerbi translation powerquery lookup-tables


    【解决方案1】:

    在 Power Query 中,您通常会进行合并而不是查找。查找表可以是用户可以更新的数据源。

    • 将查找表加载为包含所有列的新查询。仅将其保存为连接,以免复制数据。
    • 在您的主查询中,合并查找查询并加入具有匹配值的列,即主查询中的Country 和查找查询中的TranslationCode,“所有项目来自第一个,匹配来自第二个” .
    • 从联合查询中扩展TranslationCode
    • 删除原Country
    • 根据您的喜好重命名列。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-11-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多