我想在 Power BI 中创建一个度量值,它是按月计算的非重复计数的标准差

I would like to create a measure in powerBI that is the standard deviation of distinct count by month

我想在 powerBI 中创建一个度量值,它是按月计算的不同 ID 计数的标准差。 IE: 对于此数据集:

Month | ID
1       A
1       B
1       A
2       C
2       D
2       E
3       F
3       G

The Counts would be:
Month | Distinct Count
1       2
2       3
3       2

标准偏差 = 0.47

谢谢!!!!!

下面是我试过但没有用的代码的迭代:

standard dev by month = STDEVX.P(values('Table'[Reporting Date By Month Year]), DISTINCTCOUNT('Table'[ID]))

使用您提供的 table 命名为 "Table" 您可以使用以下度量来获得标准偏差。

Standard Deviation = 

var grouped_table = SUMMARIZE('Table','Table'[Month],"Distinct Count",DISTINCTCOUNT('Table'[ID]))

var st_dev = STDEVX.P(grouped_table,[Distinct Count])

return(st_dev)

度量使用变量使度量更易于阅读。第一个 table 生成月份组和相应的不同 ID 计数。第二个变量通过不同计数度量计算 table 的标准差。