Excel和Power查询:使用最新日期合并
我能够使用帐户编号作为我的钥匙来合并(内部加入)交易表与所有者信息表,以获取以下结果:
我需要链接到当前所有者的交易(s )帐户。但是,如您所见,对于9/16/2016的交易,它也链接到没有该帐户直到很久以后才拥有该帐户的所有者。同样,需要将11/27/2020交易链接到新所有者,所以我正在寻找类似的东西:
由于二级所有者没有改变,因此玛丽适用于两项交易。
对于其他帐户,在次要所有者更改时,主要所有者也可以保持相同。也有最多有4个二级所有者的帐户。
因此,简而言之,我需要交易日期才能与先前的最新所有者更改日期匹配。
我是电源查询的新手,因此我不知道使用PQ或简单地使用Excel函数/公式更好。还是我需要采取其他数据操纵/转换步骤?
I was able to merge(inner join) a transaction table with an owner info table using account number as my key to get the following results:
I need the transactions to be linked to the current owner(s) of the account. But as you can see, for the 9/16/2016 transaction, it is also linked to an owner who did not own the account until much later. Similarly, the 11/27/2020 transaction needs to be linked to the newer owner, so I am looking for something like this:
Since the secondary owner does not change, Mary applies to both transactions.
For other accounts, it is also possible for the primary owner to remain the same while the secondary owner has changed. There are also accounts in which there are up to 4 secondary owners.
So, in short, I need the transaction dates to match up with the previous, most recent Owner Change Date for both primary and secondary owner(s).
I am new to Power Query, so I do not know whether this is better done using PQ or simply Excel functions/formulas. Or maybe there are additional data manipulation/transformation steps I need to take before this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设您从2个表开始,看起来像这样:
所有者:
:
您可以使用函数来滤波所有者基于交易日期,将partiton应用于所有者类型,然后返回最新所有者,对于每个事务行:
返回:
Assuming you start with 2 tables, which look something like this:
Owners:
Transactions:
You can use a function to filter owners based on transaction date, apply a partiton to owner type, and return the latest owner, for each transaction row:
This returns: