使用唯一标识进行Power BI汇总,并允许在其他维度上进行筛选。

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

Power BI Summarize by Unique ID and allow filtering on other dimensions

问题

我有一个数据集,每个'case'都有一个唯一的ID,但是每个'case'可以与多个维度关联,因此有多行数据。但是由于只有一个唯一的ID或case,当将其与其他金额相加时,在下面的场景中,BR_1只需计算一次,即£4000。我见过的所有解决方案(SUMMARIZE、CALCULATE)仅适用于有限的场景,但解决方案需要是动态的,这样如果有人选择了HR、Alpha、Customer,则总金额将为4500(如果选择了Sales、Alpha、Customer,则总额为£4000)。

使用唯一标识进行Power BI汇总,并允许在其他维度上进行筛选。

英文:

I have a dataset that has a unique ID for each 'case' but there are multiple rows as each 'case' can be linked to several dimensions. But as there is only one unique ID or case, when summing this with other amounts, in the scenario below, BR_1 needs to be counted only once as £4000. All the solutions I've seen (SUMMARIZE, CALCULATE) works only for a finite scenario but the solution needs to be dynamic so that if someone say selected HR, Alpha, Customer the total amount would be 4500. (And if they selected Sales, Alpha Customer, the total is £4000.

使用唯一标识进行Power BI汇总,并允许在其他维度上进行筛选。

答案1

得分: 1

你可以使用以下的方法:

SUMX(SUMMARIZE(table, table[ID], table[Amount]), table[Amount])

这将适用于不同类别中的任何过滤器组合,并且只会计算每个金额一次。但是,前提是每个ID要么始终具有相同的金额,要么在相同ID的“案例”中只有一行,并且强制不同的过滤器始终被选择。

英文:

You can use the following measure:

SUMX(SUMMARIZE(table, table[ID], table[Amount]), table[Amount])

This will work with any combination of filters in the different categories and will only count each amount once. The caveat is that either each ID has to have always the same Amount or you need to have only one row per "case" for the same id and force the different filters to always be selected.

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

发表评论

匿名网友

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

确定