【发布时间】:2020-09-07 13:00:47
【问题描述】:
Team ID FRUIT
Team1 ID1 apple
Team1 ID2 apple
Team1 ID4 apple
Team1 ID5 apple
Team1 ID6 apple
Team1 ID7 apple
Team1 ID9 apple
Team2 ID11 apple
Team2 ID13 apple
Team2 ID14 apple
Team2 ID15 apple
Team2 ID17 apple
Team1 ID1 pear
Team1 ID4 pear
Team1 ID5 pear
Team1 ID8 pear
Team2 ID13 pear
Team2 ID15 pear
Team2 ID16 pear
Team2 ID17 pear
Team2 ID18 pear
Team2 ID19 pear
Team2 ID20 pear
Team1 ID1 strawberry
Team1 ID5 strawberry
Team2 ID20 strawberry
Team1 ID3
Team1 ID7
Team1 ID9
Team1 ID10
Team2 ID12
我尝试在 PowerBI 中计算: 在每个 TEAM 中,不同 ID 的百分比具有每种类型的 FRUIT。 (需要保留 FRUIT 变量的空白行,因为某些 ID 没有 FRUIT 数据,但需要计入分母)
我的预期结果是:
Team1 apple 70%
Team2 apple 50%
Team1 pear 40%
Team2 pear 70%
Team1 strawberry 20%
Team2 strawberry 10%
Team1 40%
Team2 10%
我使用了以下措施,但没有奏效,有人可以帮忙吗?谢谢。
Measure =
CALCULATE(
DISTINCTCOUNT(Sheet1[ID]),
GROUPBY(
Sheet1,
Sheet1[FRUIT]
)
)/
CALCULATE(
DISTINCTCOUNT(Sheet1[ID]),
GROUPBY(
Sheet1,
Sheet1[TEAM]
)
)
【问题讨论】:
-
请从这些输入数据中添加您预期的最终输出。 “拥有每种水果”是什么意思?有没有单独列出所有水果的清单?或者您需要从“FRUIT”列中列出该列表?
-
非常感谢。我已经添加了如上所述的预期结果。
-
如果您至少在计算上解释第一行如何获得 70% 将非常有帮助。
-
是的。 Team1 中一共有 10 个不同的 ID,而 Team1 中有 7 个不同的 ID 带有“apple”,所以 10 个中有 7 个。
-
最后一个问题,您想要一个新的汇总表吗?还是测量?
标签: powerbi percentage