Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Powerbi DAX查询,将计算列添加到power bi表,该表计算列的总和_Powerbi_Dax - Fatal编程技术网

Powerbi DAX查询,将计算列添加到power bi表,该表计算列的总和

Powerbi DAX查询,将计算列添加到power bi表,该表计算列的总和,powerbi,dax,Powerbi,Dax,DAX查询将如何向power bi表添加计算列,该表仅在满足特定条件的情况下计算包含这些行的列的总和。例如 如果表格如下所示: id city count 1 x 2 2 y 3 3 z 1 1 u 6 2 v 3 id city count totalcount 1 x 2 8

DAX查询将如何向power bi表添加计算列,该表仅在满足特定条件的情况下计算包含这些行的列的总和。例如

如果表格如下所示:

id    city       count
1      x         2
2      y         3
3      z         1
1      u         6
2      v         3
id    city       count    totalcount
1      x         2        8       
2      y         3        6
3      z         1        1
1      u         6        8
2      v         3        6
我想向表中添加列总数,而不是度量值。 通过添加基于相同id的计数来计算总计数。 预期的表格应如下所示:

id    city       count
1      x         2
2      y         3
3      z         1
1      u         6
2      v         3
id    city       count    totalcount
1      x         2        8       
2      y         3        6
3      z         1        1
1      u         6        8
2      v         3        6

尝试将
SUMX
过滤器一起使用:

totalcount = SUMX(FILTER(MyTable, MyTable[id] = EARLIER(MyTable[id])),[count])