如何在Tableau中创建交集数据 [英] How to create intersection data in Tableau
问题描述
我有一个需要解决的问题,这有点简单,但是我无法解决.非常感谢您的帮助.
I have a problem that I need to solve which is somewhat simplistic but I can't work it out. Any help is much appreciated.
好.我有一百万条记录的数据集:
ok. I have a dataset of a million records:
TransId, PersonGUID, Origin.
来源有2个选项:[信用,当前]
Origin has 2 options: [Credit, Current]
现在,我只需要筛选出PersonGUID的Credit和Current中至少有两行的那些事务.
Now, I need to filter down to only those transactions where a PersonGUID has had both at least 1 row in Credit and Current.
我可以在PythonPandas中轻松地做到这一点并加载到CSV中,但是我不希望有2个数据集,因为我将围绕所有数据构建一个仪表板.
I can do this somewhat easily in PythonPandas and load in the CSV but I don't want 2 datasets as I'll be building a dashboard around ALL data.
我正在猜测一个布尔逻辑计算字段,但无法解决.
I am guessing a boolean logic calculated field but I can't work it out.
谢谢
Rob
推荐答案
您需要的是条件过滤器.
What you need is a conditional filter.
拖动PersonGUID进行过滤,然后选择选项卡条件".选择公式",然后插入一些公式,该公式将提供所需的结果.大概是这样的:
Drag PersonGUID to filter, and choose the tab Condition. Select Formula and insert some formula that will give the result you want. Probably something like:
SUM(
IF Origin = 'Credit' THEN 1 ELSE 0 END
) > 0
AND
SUM(
IF Origin = 'Current' THEN 1 ELSE 0 END
) > 0
如果用户没有"Credit",则第一个总和为0,否则为> 0.与第二个逻辑相同.
The first sum will be 0 if there's no 'Credit' for the user, and >0 otherwise. Same logic to the second.
这样,将对每个PersonGUID进行此计算,您将实现所需的功能
This way, this calculation will be made to each PersonGUID, and you'll achieve what you need
这篇关于如何在Tableau中创建交集数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!