简体   繁体   English

Tableau 中的不同值的总和

[英]Distinct sum of values in Tableau

I have a data with columns called Brand, Market and Target.我有一个数据,其中包含名为 Brand、Market 和 Target 的列。 The Brand having members like A, B, C & D repeats across 2 kinds of Market - OPL and CPL.拥有 A、B、C 和 D 等成员的品牌在 2 种市场 - OPL 和 CPL 中重复。 So the Target for each of Brand and Market also repeats in column Target, as in below image:因此,每个品牌和市场的目标也在目标列中重复,如下图所示:

在此处输入图片说明

All I would want is to get sum of Target for each of Brand at OPL (highlighted in orange) and sum of Target for each of Brand at CPL (highlighted in yellow)我想要的只是获得 OPL 中每个品牌的目标总和(以橙色突出显示)和 CPL 中每个品牌的目标总和(以黄色突出显示)

So sum for OPL should be 10000 + 7000 + 4000 + 9000 = 30000 and sum for CPL should be 5000 + 2000 + 8000 + 3000 = 18000所以 OPL 的总和应该是 10000 + 7000 + 4000 + 9000 = 30000 而 CPL 的总和应该是 5000 + 2000 + 8000 + 3000 = 18000

I used a logic like我使用了类似的逻辑

IF [Market] = 'OPL' THEN {FIXED [Brand]+[Market] : MIN([Target])} END IF [Market] = 'OPL' THEN {FIXED [Brand]+[Market] : MIN([Target])} END

Image as below:图像如下:

在此处输入图片说明

which gave me total of target at OPL which is 58000, which is not the one I wanted.这给了我 OPL 的总目标是 58000,这不是我想要的。 Please help me with correct calculation, do let me know for any further details.请帮我正确计算,请让我知道任何进一步的细节。

Try this:试试这个:

SUM( { FIXED [Brand], [Market]: AVG(Target) } )

Averaging within each Market and Brand will eliminate the duplicates in your sum.每个市场和品牌内的平均将消除您总和中的重复项。

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

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