简体   繁体   English

有没有办法在粒度级别对不同的数字进行计数,以在画面中聚合多个条件?

[英]Is there a way to count distinct number at granular level to aggregate level with multiple condition in tableau?

I have a situation wherein I want to count the distinct customer.in a table with a condition per product.我有一种情况,我想在每个产品的条件表中计算不同的客户。 I want a summary count of distinct customers per product.我想要每种产品的不同客户的汇总计数。

I created a parameter which shows what I want to be included and what should not be counted.我创建了一个参数,它显示了我想要包含的内容以及不应该计算的内容。 The rules applied on the status are written below:应用于状态的规则如下:

IF ATTR([Product]) = 'A' AND COUNT([Record]) >= 10 THEN 'Should be counted'
 
ELSEIF ATTR([Product]) = 'B' AND COUNT([Record]) >= 5 THEN 'Should be counted'
 
ELSEIF ATTR([Product]) = 'C' AND COUNT([Record]) >= 3 THEN 'Should be counted'
 
ELSE 'Should not be counted'
 
END

Since the data is transaction per row.由于数据是每行的事务。 Think of record as purchases.将记录视为购买。 I am only interested in the right side of the crosstab CountD column.我只对交叉表 CountD 列的右侧感兴趣。 Please refer to the image below.请参考下图。

在此处输入图像描述

How can I achieve a summary using distinct customers per product considering only repeat purchases for product A >=10, product B>=5 and product C>=3.. If I remove the customer name everything will be aggregated and undesirable.考虑到产品 A >=10、产品 B>=5 和产品 C>=3 的重复购买,我如何使用每个产品的不同客户来获得摘要。如果我删除客户名称,所有内容都将被汇总且不可取。

在此处输入图像描述

I want my output to be like the one below.我希望我的 output 与下面的一样。

在此处输入图像描述

Any help will be so much appreciated.任何帮助将不胜感激。 Can someone share/teach me the steps to achieve the kind of output that I desire.有人可以分享/教我实现我想要的 output 的步骤吗?

Thank you in advance先感谢您

Joseph约瑟夫

Though it would have been better if you'd shared the data structure, yet I think the following calculated field may help虽然如果您共享数据结构会更好,但我认为以下计算字段可能会有所帮助

{FIXED [Product] : COUNTD([CUSTOMER])}

Needless to say, If you want counting of filtered records, you should include [STATUS] field on filters shelf and Add to Context after right clicking it in the filters shelf itself (because order of operations of LOD calculations is higher than normal filters but lower than context filters)不用说,如果你想统计过滤记录,你应该在过滤器架子上包含[STATUS]字段,并在过滤器架子本身中右键单击它后Add to Context (因为 LOD 计算的操作顺序高于普通过滤器但低于比上下文过滤器)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM