Power BI-将COUNT除以DISTINCTCOUNT

问题描述 投票:0回答:1

如何在Power BI中创建度量以将COUNT除以同一事物的DISTINCTCOUNT?

示例:源数据-仅一列:

  • PERSON
    • A
    • A
    • A
    • B
    • B
    • C

现在我想显示以下结果:

  • 人...外观

  • A ... 3

  • B ... 2

  • C ... 1

如果我通过APPEARANCES = COUNT(PERSON)/ DISTINCTCOUNT(PERSON)尝试此操作,则无效。

谢谢。

count powerbi distinct measure
1个回答
0
投票

这应该可以帮助您:

APPEARANCES =
DIVIDE (
    COUNT ( Tabla[Person] ),
    CALCULATE ( DISTINCTCOUNT ( Tabla[Person] ), ALL ( Tabla[Person] ) ),
    BLANK ()
)

如果需要,您可以将lat BLANK()更改为0。

这是我的结果:

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.