如何使用DAX计算带有筛选条件的SUM?

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

How to calculate SUM with filter using DAX?

问题

我将首先筛选列,然后计算其总和。
我是这样做的

Total = SUMX(FILTER('Backlog items', 'Backlog items'[Name]="*Student*"),[Score])

我需要计算[Score]的总和,当[Name]包含Student时,但结果仍然为空,因为它无法捕捉筛选条件。

有人能帮我想个办法吗?
非常感谢您的帮助。

英文:

I am going to calculate the sum of a column by filtering it first.
I did this way

Total = SUMX(FILTER('Backlog items', 'Backlog items'[Name]="*Student*"),[Score])

I need to calculate the sum of [Score] when the [Name] contains of Student, but the result is still empty, because it can't catch the filter.

Anyone can help me to have an idea about it?
Thank you so much for the help.

答案1

得分: 1

你可以使用CONTAINSSTRING函数,例如像这样:

Total = SUMX(
    FILTER('Backlog items', 
        CONTAINSSTRING('Backlog items'[Name], "Student")
    ), [Score])
英文:

You can use CONTAINSSTRING function, for example like this:

Total = SUMX(
    FILTER('Backlog items', 
        CONTAINSSTRING('Backlog items'[Name], "Student")
    ), [Score])

huangapple
  • 本文由 发表于 2023年3月9日 13:25:01
  • 转载请务必保留本文链接:https://go.coder-hub.com/75680724.html
匿名

发表评论

匿名网友

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

确定