我尝试在PowerBI中将DAX组功能用作度量,新列,新表,但是在验证该功能时出现错误,
New Table = GROUPBY(
'tab1',
'tab1'[color],
"Group By color",
sum('tab1'[count_lables])
)
Error : Function 'GROUPBY' scalar expressions have to be Aggregation functions over CurrentGroup(). The expression of each Aggregation has to be either a constant or directly reference the columns in CurrentGroup().
Run Code Online (Sandbox Code Playgroud)
该错误表明您需要在组上使用聚合函数,而正在使用的SUM
函数不会对任何组上的值求和。在您的情况下,您需要将SUMX
聚合功能与CURRENTGROUP()
option 一起使用。在CURRENTGROUP
确定必须基于当前行上被添加的组。
请尝试使用以下表达式。
New Table = GROUPBY (
tab1,
tab1[color],
"Group by color", SUMX ( CURRENTGROUP (), tab1[count lables] )
)
Run Code Online (Sandbox Code Playgroud)
让我知道是否有帮助。
归档时间: |
|
查看次数: |
13726 次 |
最近记录: |