英文:
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])
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论