Power BI/Power Query Error: A circular dependency was detected in deduplicate strings count

Power BI/Power Query Error: A circular dependency was detected in deduplicate strings count

我有一个字符串列,我想在 Power Query 中计算 distinct/deduplicate 个字符串,如下所示:

Content
"StringOne"
"StringTwo"
"StringOne"
"StringThree"

我想要每个唯一字符串的计数,如下所示:[StringOne + StringTwo + StringThree + (StringOne - StringOne)]

Content SumMessageTag
StringOne 3
StringTwo 3
StringOne 3
StringThree 3

所以 Distinct Count 总和应该是 3,而不是 4

这是我目前的情况:

SumMessageTag = CALCULATE(DISTINCTCOUNT(data[Content]), data[Content])

出现的错误是:检测到循环依赖。

以下是 Power BI 为 数字 值推荐的值:

SumMessageTag = SUMX(DISTINCT(Table1[number]), Table1[number])

但是 SUMX 不适用于字符串。

并使用:

SumMessageTag = CALCULATE(DISTINCTCOUNT(data[Content]))

returns:

Content SumMessageTag
StringOne 1
StringTwo 1
StringOne 1
StringThree 1

这也不是我想要的。

我找到了一个有效的选项:

SumMessageTag = COUNTROWS(DISTINCT(data[Content]))

它提供了我想要的计数。