按多列的多行过滤计数

huangapple go评论62阅读模式
英文:

Count filtered by multiple rows of a column

问题

I'm stuck in a measure, I need to use DAX to calculate the count of students who passed only the 3 subjects at the same time. I've tried through VAR's and IF's but still haven't been able to get the intended result.
Below I leave an image with example data.

按多列的多行过滤计数

The right result will be 2, but with the options I tried it just gives me 4 or blank.

# Students =
CALCULATE (
    COUNT ( Table[Student] ),
    Table[subjet] = "Math",
    Table[subjet] = "Writing",
    Table[subjet] = "Reading"
)

Thanks in advance for anyone's help.

英文:

I'm stuck in a measure, I need to use DAX to calculate the count of students who passed only the 3 subjects at the same time. I've tried through VAR's and IF's but still haven't been able to get the intended result.
Below I leave an image with example data.

按多列的多行过滤计数

The right result will be 2, but with the options I tried it just gives me 4 or blank.

# Students =
CALCULATE (
    COUNT ( Table[Student] ),
    Table[subjet] = "Math",
    Table[subjet] = "Writing",
    Table[subjet] = "Reading"
)

Thanks in advance for anyone's help.

答案1

得分: 0

这是您的翻译:

# 学生 = 
VAR tbl = 
    FILTER(
        SUMMARIZE(
            '表格',
            '表格'[学生ID],
            "计数", COUNTROWS('表格')
        ),
        [计数] = 3
    )
RETURN
    COUNTX(tbl, [学生ID])
英文:

Here you are.

# Students = 
VAR tbl = 
    FILTER(
        SUMMARIZE(
            'Table',
            'Table'[Student ID],
            "Count", COUNTROWS('Table')
        ),
        [Count] = 3
    )
RETURN
    COUNTX(tbl, [Student ID])

huangapple
  • 本文由 发表于 2023年3月15日 20:16:15
  • 转载请务必保留本文链接:https://go.coder-hub.com/75744567.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定